Sunlitt / SunKit

SunKit is a Swift library which uses math and trigonometry to compute several information about the Sun.
Apache License 2.0
144 stars 12 forks source link

Dawn/dusk times reversed? #40

Closed atomicbird closed 1 year ago

atomicbird commented 1 year ago

When testing SunKit, the dumpDateInfos function includes the following:

Civil dusk          -> Tuesday, May 2, 2023 at 5:31:09 AM Mountain Daylight Time
Civil Dawn           -> Tuesday, May 2, 2023 at 8:21:42 PM Mountain Daylight Time
Nautical Dusk     -> Tuesday, May 2, 2023 at 4:56:05 AM Mountain Daylight Time
Nautical Dawn      -> Tuesday, May 2, 2023 at 8:56:46 PM Mountain Daylight Time
Astronomical Dusk -> Tuesday, May 2, 2023 at 4:18:26 AM Mountain Daylight Time
Astronomical Dawn  -> Tuesday, May 2, 2023 at 9:34:25 PM Mountain Daylight Time

In each case, dawn is shown as being in the evening, while dusk is in the morning.

I thought at first that the dawn times were for tomorrow, i.e. the next time dawn arrived, but they all show the same date. Printing their UTC values shows the same issue, dusk occurs before dawn:

Civil dawn: 2023-05-03 02:21:42 +0000
Civil dusk: 2023-05-02 11:31:09 +0000

Nautical dawn: 2023-05-03 02:56:46 +0000
Nautical dusk: 2023-05-02 10:56:05 +0000

Astronomical dawn: 2023-05-03 03:34:25 +0000
Astronomical dusk: 2023-05-02 10:18:26 +0000

I don’t know if this means dawn and dusk times are reversed or if there’s some other problem.

My Package.resolved shows that I’m using tag 2.6.3, so I should be up to date.

seldon1000 commented 1 year ago

Hello. The solar events' names are indeed inverted: dawn happens in the morning while dusk happens in the evening. Thank you for reporting. A fix should come soon in the next release.

davideilmito commented 1 year ago

Hi @atomicbird, the fix shall be on main branch. If you liked the package leave a star ;).

atomicbird commented 1 year ago

Thank you!