Thank you for this useful library!
I noticed a confusing behavior with sunrise_and_set.
It seems that it only returns the sunrise/sunset for the current day, if the provided UTC timestamp is in the afternoon (i.e. >=12:00:00). Otherwise, it returns the sunrise/sunset for the day before the timestamp.
Adapted from the examples:
// timestamp at 11:00:00
sunrise_and_set::<StdFloatOps>(Utc.with_ymd_and_hms(2024, 6, 6, 11, 0, 0).single().unwrap(), 50.0, 10.0)
returns Ok(Daylight(2024-06-05T03:11:26.451798784Z, 2024-06-05T19:24:04.258497792Z))
(notice the date is 2024-06-05),
while
// timestamp at 12:00:00
sunrise_and_set::<StdFloatOps>(Utc.with_ymd_and_hms(2024, 6, 6, 12, 0, 0).single().unwrap(), 50.0, 10.0)
returns Ok(Daylight(2024-06-06T03:11:25.293687808Z, 2024-06-06T19:24:06.347200768Z))
with the expected date 2024-06-06.
Is this behavior expected? If yes, then it would be nice to document that in the README. I expected the sunrise/sunset to be for the same date as the provided timestamp.
Thank you for this useful library!
I noticed a confusing behavior with
sunrise_and_set.It seems that it only returns the sunrise/sunset for the current day, if the provided UTC timestamp is in the afternoon (i.e. >=12:00:00). Otherwise, it returns the sunrise/sunset for the day before the timestamp.
Adapted from the examples:
returns
Ok(Daylight(2024-06-05T03:11:26.451798784Z, 2024-06-05T19:24:04.258497792Z))(notice the date is 2024-06-05),
while
returns
Ok(Daylight(2024-06-06T03:11:25.293687808Z, 2024-06-06T19:24:06.347200768Z))with the expected date 2024-06-06.
Is this behavior expected? If yes, then it would be nice to document that in the README. I expected the sunrise/sunset to be for the same date as the provided timestamp.