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

Re-define Unitful's yr (year) unit to be 365.2425 days #740

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jakewilliami
Copy link

@jakewilliami jakewilliami commented Sep 18, 2024

Specify Unitful's year unit to be 365.2425 days.

This is the true average number of days in the Gregorian year, every year that is exactly divisible by four is a leap year, except for years that are exactly divisible by 100, but these centurial years are leap years, if they are exactly divisible by 400.

See Dates.isleapyear and Dates.days(::Year).

This is a suggested change in the interest of correctness, but it likely doesn't make much of a difference to most people!

See also #288.

This is the true average number of days in the Gregorian year, every
year that is exactly divisible by four is a leap year, except for
years that are exactly divisible by 100, but these centurial years are
leap years, if they are exactly divisible by 400.

See `Dates.isleapyear`:
https://github.com/JuliaLang/julia/blob/00739173/stdlib/Dates/src/types.jl#L206
The average number of days in a year should be the same in both
Unitful and the Dates stdlib.

We also add a reference to this function in the documentation for this
unit.
@jakewilliami
Copy link
Author

Apologies, I made a syntax error that I didn't catch. I've rectified it.

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.

1 participant