Closed
Description
The Year
type faithfully represents all the years from -271820 to 275759, but passing, e.g., toEnum 1
into canonicalDate
produces a date in the year 1901, not the year 1 as one would expect.
Example code:
show <<< year $ canonicalDate (fromMaybe bottom $ toEnum 1) January bottom
...produces "(Year 1901)"
, instead of "(Year 1)"
.
The culprit seems to be on the JavaScript side of things; while the Date
type can represent dates like '0001-01-01', creating them the way canonicalDate
does, which is new Date(Date.UTC(y, m - 1, d))
, "helpfully" "fixes" the year number to after 1900.