Skip to content

bug: Incorrect Sunrise/Sunset Date for Timezones Ahead of UTC #30

@fa0311

Description

@fa0311

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

  1. Input a datetime in a timezone that is ahead of UTC (e.g., Asia/Tokyo (JST)).
  2. Example: Provide January 1st, 00:00 JST.
  3. Internally, this is converted to December 31st, 15:00 UTC.
  4. The time component is then discarded, and only the date is used for sunrise/sunset calculation.
  5. As a result, the calculation is performed for December 31st instead of January 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions