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.

@sostock sostock added the v2.0 label Nov 17, 2024
@sostock
Copy link
Collaborator

sostock commented Nov 17, 2024

To me, 365.2425 days seems like the correct value. I don’t know why 365.25 was chosen. Maybe there is a scientific field where 365.25 days is commonly used? Anyway, I think this is a good change, but I consider it breaking, so it can only be changed in Unitful v2.0.

@PatrickHaecker
Copy link

I do not know whether this is related, but the light year seems to be defined by the Julian year, so it might make sense to check whether UnitfulAstro is affected by this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants