daylight
daylight copied to clipboard
bug: Incorrect Sunrise/Sunset Date for Timezones Ahead of UTC
Description
When the timezone is ahead of UTC, the retrieved sunrise and sunset times are calculated for the incorrect date, causing a one-day shift.
Steps To Reproduce
- Input a datetime in a timezone that is ahead of UTC (e.g.,
Asia/Tokyo (JST)). - Example: Provide
January 1st, 00:00 JST. - Internally, this is converted to
December 31st, 15:00 UTC. - The time component is then discarded, and only the date is used for sunrise/sunset calculation.
- As a result, the calculation is performed for
December 31stinstead ofJanuary 1st.
Expected Behavior
The sunrise and sunset times should be calculated for the intended local date (January 1st in this example).
Screenshots
...
Additional Context
https://github.com/bluefireteam/daylight/blob/3.1.0/lib/src/daylight.dart#L157-L158