Unitful.jl icon indicating copy to clipboard operation
Unitful.jl copied to clipboard

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

Open jakewilliami opened this issue 1 year ago • 3 comments

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.

jakewilliami avatar Sep 18 '24 11:09 jakewilliami

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

jakewilliami avatar Oct 01 '24 11:10 jakewilliami

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.

sostock avatar Nov 17 '24 12:11 sostock

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.

PatrickHaecker avatar Dec 09 '24 09:12 PatrickHaecker

@sostock whoops, I deleted the fork, didn't realise that would close the PR. Can this be reopened?

jakewilliami avatar Sep 01 '25 22:09 jakewilliami

The PR can't be reopened without you restoring the fork with exactly the same content. But even with this PR not reopened the content is accessible.

giordano avatar Sep 01 '25 22:09 giordano