Skip to content

Dates before the year 1901 are not handled correctly by canonicalDate and exactDate #46

Closed
@tdammers

Description

@tdammers

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething that should function correctly isn't.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions