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

Strict validation works invalid #1766

Closed
Aleksandra973 opened this issue Jan 14, 2022 · 3 comments
Closed

Strict validation works invalid #1766

Aleksandra973 opened this issue Jan 14, 2022 · 3 comments

Comments

@Aleksandra973
Copy link

Describe the bug
dayjs('190-12-01', 'YYYY-MM-DD', 'es', true).isValid()
Why does this method return true? Year consist 3 numbers instead of 4

Expected behavior
Return false

Information

  • Day.js Version [^1.10.7]
  • MacOS
  • Browser 88.0.4324.192 (Official Build) (x86_64)
  • Time zone: [e.g. GMT+03:00 ]
@tshyti-ritech
Copy link

tshyti-ritech commented Jan 21, 2022

you must extend the customParseFormat so that the strict validation works.

import customParseFormat from "dayjs/plugin/customParseFormat";
dayjs.extend(customParseFormat)

@ipauler
Copy link

ipauler commented Mar 24, 2023

you must extend the customParseFormat so that the strict validation works.

import customParseFormat from "dayjs/plugin/customParseFormat";
dayjs.extend(customParseFormat)

Thanks!
That should be mentioned in docs i believe

@Aleksandra973
Copy link
Author

Thanks

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

3 participants