Before, Astronoby::Sun would expect an epoch (Float) key argument as
initializer param.
Now, it expects a time (Time) argument.
This is more convenient because an epoch doesn't provide information
about the observer's time zone.
Time.new(1991, 3, 14, 6, 0, 0, "+10:00") and
Time.utc(1991, 3, 13, 20, 0, 0) are the same instant in time, and are
converted to the same Julian Day, but they do not represent the same day
depending on if we consider the time zone.
If a developer provides a local time with a time zone, they would expect
to receive sunrise and sunset times from the given day, not the one
represented from the time in UTC.
This change fixes this behaviour and includes two new tests to ensure
the local day is preserved when the provided time is not in UTC.
Before,
Astronoby::Sun
would expect anepoch
(Float
) key argument as initializer param.Now, it expects a
time
(Time
) argument.This is more convenient because an epoch doesn't provide information about the observer's time zone.
Time.new(1991, 3, 14, 6, 0, 0, "+10:00")
andTime.utc(1991, 3, 13, 20, 0, 0)
are the same instant in time, and are converted to the same Julian Day, but they do not represent the same day depending on if we consider the time zone. If a developer provides a local time with a time zone, they would expect to receive sunrise and sunset times from the given day, not the one represented from the time in UTC.This change fixes this behaviour and includes two new tests to ensure the local day is preserved when the provided time is not in UTC.