Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Astronoby::Sun constructor #64

Merged
merged 3 commits into from
Apr 21, 2024
Merged

Conversation

rhannequin
Copy link
Owner

@rhannequin rhannequin commented Apr 19, 2024

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, `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.
@rhannequin rhannequin changed the title Change sun constructor Change Astronoby::Sun constructor Apr 19, 2024
@rhannequin rhannequin self-assigned this Apr 19, 2024
@rhannequin rhannequin merged commit 974eb64 into main Apr 21, 2024
7 checks passed
@rhannequin rhannequin deleted the change-sun-constructor branch April 21, 2024 20:51
rhannequin added a commit that referenced this pull request Apr 29, 2024
 ## What's Changed

_If you are upgrading: please see [UPGRADING.md]._

[UPGRADING.md]: https://github.com/rhannequin/astronoby/blob/main/UPGRADING.md

 ### Bug fixes

* Fix ecliptic to equatorial epoch ([#56])

[#56]: #56

 ### Features

* Add twilight times ([#49])
* Add interpolation method ([#52])
* Add decimal_hour_to_time util ([#53])
* Calculate leap seconds for an instant ([#54])
* Add `Angle#-@` ([#55])
* Enable equivalence and hash equality to `Observer` ([#57])
* Twilight events dedicated class ([#61])

[#49]: #49
[#52]: #52
[#53]: #53
[#54]: #54
[#55]: #55
[#57]: #57
[#61]: #61

 ### Improvements

* Upgrade bundler from 2.3.11 to 2.5.7 by @dorianmariecom ([#45])
* Drop `BigDecimal` ([#46])
* Bump rake from 13.1.0 to 13.2.0 ([#47])
* Increase Ruby versions support ([#48])
* Bump rake from 13.2.0 to 13.2.1 ([#51])
* Dedicated constants class ([#62])
* Improve accuracy of equation of time ([#63])
* Twilight times better accuracy ([#65])
* Update UPGRADING.md ([#66])
* release: Bump version to 0.4.0 ([#67])

[#45]: #45
[#46]: #46
[#47]: #47
[#48]: #48
[#51]: #51
[#62]: #62
[#63]: #63
[#65]: #65
[#66]: #66
[#67]: #67

 ### Backward-incompatible changes

* More accurate rising, transit and setting times ([#50])
* Observation events dedicated and centralized class ([#60])
* Change `Astronoby::Sun` constructor ([#64])

[#50]: #50
[#60]: #60
[#64]: #64

 ## New Contributors

* @dorianmariecom made their first contribution in [#45]

[#45]: #45

**Full Changelog**: v0.3.0...v0.4.0
rhannequin added a commit that referenced this pull request Apr 29, 2024
## What's Changed

_If you are upgrading: please see [UPGRADING.md]._

[UPGRADING.md]: https://github.com/rhannequin/astronoby/blob/main/UPGRADING.md

 ### Bug fixes

* Fix ecliptic to equatorial epoch ([#56])

[#56]: #56

 ### Features

* Add twilight times ([#49])
* Add interpolation method ([#52])
* Add decimal_hour_to_time util ([#53])
* Calculate leap seconds for an instant ([#54])
* Add `Angle#-@` ([#55])
* Enable equivalence and hash equality to `Observer` ([#57])
* Twilight events dedicated class ([#61])

[#49]: #49
[#52]: #52
[#53]: #53
[#54]: #54
[#55]: #55
[#57]: #57
[#61]: #61

 ### Improvements

* Upgrade bundler from 2.3.11 to 2.5.7 by @dorianmariecom ([#45])
* Drop `BigDecimal` ([#46])
* Bump rake from 13.1.0 to 13.2.0 ([#47])
* Increase Ruby versions support ([#48])
* Bump rake from 13.2.0 to 13.2.1 ([#51])
* Dedicated constants class ([#62])
* Improve accuracy of equation of time ([#63])
* Twilight times better accuracy ([#65])
* Update UPGRADING.md ([#66])
* release: Bump version to 0.4.0 ([#67])

[#45]: #45
[#46]: #46
[#47]: #47
[#48]: #48
[#51]: #51
[#62]: #62
[#63]: #63
[#65]: #65
[#66]: #66
[#67]: #67

 ### Backward-incompatible changes

* More accurate rising, transit and setting times ([#50])
* Observation events dedicated and centralized class ([#60])
* Change `Astronoby::Sun` constructor ([#64])

[#50]: #50
[#60]: #60
[#64]: #64

 ## New Contributors

* @dorianmariecom made their first contribution in [#45]

[#45]: #45

**Full Changelog**: v0.3.0...v0.4.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant