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

MM > 12 and DD > 31 do not result in invalid date #1935

Closed
GamerBene19 opened this issue Jun 9, 2022 · 2 comments
Closed

MM > 12 and DD > 31 do not result in invalid date #1935

GamerBene19 opened this issue Jun 9, 2022 · 2 comments

Comments

@GamerBene19
Copy link

GamerBene19 commented Jun 9, 2022

Describe the bug
Executing dayjs("2022-99-99", "YYYY-MM-DD") does result in a valid date.

Expected behavior
Date should be invalid

Information

  • Day.js Version: 1.11.2
  • OS: Arch, up to date
  • Browser: Firefox version 101.0
  • Time zone: CEST

The issue likely affects other possible format strings aswell (e.g. seconds > 60 (in the context of timestamps)), but I have only experienced and tested it with the above format.

@BePo65
Copy link
Contributor

BePo65 commented Jun 9, 2022

That is not an error, but by design (see my comments in pr #1914).

If you want the result to be 'Invalid Date' then use the strict option ('true' as 3rd parameter).
Without strict mode, dayjs behaves like the javascript Date object using 'overflow'.

@GamerBene19
Copy link
Author

I see. Sorry, for the unnecessary issue ^^

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

No branches or pull requests

2 participants