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

bug: isMatch validates "isMatch("20-02-02", "yyyy-MM-dd")" #3799

Open
maxkomarychev opened this issue May 15, 2024 · 0 comments
Open

bug: isMatch validates "isMatch("20-02-02", "yyyy-MM-dd")" #3799

maxkomarychev opened this issue May 15, 2024 · 0 comments

Comments

@maxkomarychev
Copy link

maxkomarychev commented May 15, 2024

It looks like isMatch does not strictly check number of digits for year:

observed:

> const {isMatch} = require('date-fns')
undefined
> isMatch("2024-02-02", "yyyy-MM-dd")
true
> isMatch("2024-02-02", "yyyy-MM-dd")
true
> isMatch("202-02-02", "yyyy-MM-dd")
true
> isMatch("20-02-02", "yyyy-MM-dd")
true
> isMatch("2-02-02", "yyyy-MM-dd")
true

expected:

only years with 4 digits should be allowed.

Screenshot 2024-05-16 at 00 13 13
@maxkomarychev maxkomarychev changed the title isMatch validates "isMatch("20-02-02", "yyyy-MM-dd")" bug: isMatch validates "isMatch("20-02-02", "yyyy-MM-dd")" May 15, 2024
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

1 participant