Skip to content

getTimes returns a sunrise/sunset on the next day for certain lat/long #174

Open
@jordanwegener

Description

Using getTimes for some coordinates (close to a TZ border) and times close to but before midnight appears to produce an incorrect sunset time that is on the following day.

To reproduce, call getTimes with:

{
  time: new Date('2022-04-14T23:40:15.817+08:00')
  lat: -14.414989274961663,
  lon: 128.52523583273717,
  timezone: 'Australia/Perth'
}

I get back:

{
  times: {
    solarNoon: 2022-04-15T03:27:08.981Z,
    nadir: 2022-04-14T15:27:08.981Z,
    sunrise: 2022-04-14T21:33:37.354Z,
    sunset: 2022-04-15T09:20:40.607Z,
    sunriseEnd: 2022-04-14T21:35:51.374Z,
    sunsetStart: 2022-04-15T09:18:26.587Z,
    dawn: 2022-04-14T21:12:00.824Z,
    dusk: 2022-04-15T09:42:17.137Z,
    nauticalDawn: 2022-04-14T20:47:00.521Z,
    nauticalDusk: 2022-04-15T10:07:17.441Z,
    nightEnd: 2022-04-14T20:22:04.702Z,
    night: 2022-04-15T10:32:13.259Z,
    goldenHourEnd: 2022-04-14T22:02:20.087Z,
    goldenHour: 2022-04-15T08:51:57.875Z
  }
}

converted to local date strings for Australia/Perth TZ

sunrise: '15/04/2022, 07:33:37'
sunset: '15/04/2022, 19:20:40'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions