Skip to content

Years below 100 not allowed? #87

@donaldpipowitch

Description

@donaldpipowitch

Hi! Not sure if this is a bug or "intended"/due to some date quirks, but I can't use a year below 100.

zonedTimeToUtc('0100-01-01', 'Europe/Berlin').toISOString()
// === "0099-12-31T23:06:32.000Z"

zonedTimeToUtc('0099-01-01', 'Europe/Berlin').toISOString()
// === "-001801-01-01T23:06:32.000Z"

Activity

marnusw

marnusw commented on Oct 7, 2020

@marnusw
Owner

Certainly not intentional. I can't guarantee that I'll be able to look at this any time soon since it seems like quite an edge case. I'd welcome a PR though. You can also check the date-fns library directly to see if they support it, because the toDate function was copied from date-fns some versions ago.

donaldpipowitch

donaldpipowitch commented on Oct 7, 2020

@donaldpipowitch
Author

Thanks for the quick reply.

make-github-pseudonymous-again

make-github-pseudonymous-again commented on Mar 7, 2022

@make-github-pseudonymous-again
Contributor
make-github-pseudonymous-again

make-github-pseudonymous-again commented on Mar 7, 2022

@make-github-pseudonymous-again
Contributor

Note that there used to be a similar bug in date-fns but it has been fixed a long time ago (November 2016).

make-github-pseudonymous-again

make-github-pseudonymous-again commented on Mar 9, 2022

@make-github-pseudonymous-again
Contributor

I get the following output on runkit (date-fnsv2.28.0, date-fns-tzv1.3.0):

zonedTimeToUtc('0099-01-01', 'Europe/Berlin').toISOString()
"1998-12-31T23:00:00.000Z"
make-github-pseudonymous-again

make-github-pseudonymous-again commented on Mar 9, 2022

@make-github-pseudonymous-again
Contributor

Just wrote a draft PR #170 fixing this issue.

marnusw

marnusw commented on Mar 31, 2022

@marnusw
Owner

Released in v1.3.2.

marnusw

marnusw commented on Oct 11, 2022

@marnusw
Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @marnusw@donaldpipowitch@make-github-pseudonymous-again

      Issue actions

        Years below 100 not allowed? · Issue #87 · marnusw/date-fns-tz