mourner / suncalc

A tiny JavaScript library for calculating sun/moon positions and phases.
BSD 2-Clause "Simplified" License
3.04k stars 407 forks source link

Sunset times are off for Australia #172

Open mhollanders opened 10 months ago

mhollanders commented 10 months ago

Hi there,

The follow code gives me the wrong sunrise and sunset times for eastern Australia; Google tells me sunset is at 17:38 AEST (UTC+10).

getSunlightTimes(date = ymd("2023-09-15"),
                 lat = 28.865, lon = 153.565,
                 tz = "Etc/GMT+10",
                 keep = c("sunrise", "sunset"))
    date    lat     lon             sunrise              sunset

1 2023-09-15 28.865 153.565 2023-09-14 09:31:32 2023-09-14 21:53:54

Any idea what's going on?

Matt

virtualgeoff commented 10 months ago

Australia is in the Southern Hemisphere; latitude should be negative!

mhollanders commented 10 months ago

Hi, you're correct. -28.865, 153.565 still gives the wrong results.

    date     lat     lon             sunrise              sunset

1 2023-09-15 -28.865 153.565 2023-09-14 09:46:16 2023-09-14 21:39:09

sepsep361 commented 8 months ago

I've got the same problem as you. Change time zone of your computer.