Date validity check does not work correctly
See original GitHub issueDescribe the bug
I tried to parse 2020-13-13 with this library and its isValid() check returned true while I expected it to return false
Expected behavior I expected the date is valid check to return false
Information
- Day.js Version [1.8.34]
- OS: [iOS]
- Browser [Node]
- Time zone: [e.g. GMT+03:00 EAT (East African Time)]
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Detecting an "invalid date" Date instance in JavaScript
You can check the validity of a Date object d via d instanceof Date && isFinite(d). To avoid cross-frame issues, one could replace...
Read more >Program to check if a date is valid or not - GeeksforGeeks
Given a date, check if it is valid or not. It may be assumed that the given date is in range from 01/01/1800...
Read more >A Date is not valid error occurs when Project Connector is ...
Fixes a problem where a "Date is not valid" error occurs when Project Connector is running on a computer where the date setting...
Read more >Use Excel Data Validation for Entering Dates - Contextures
Restrict Date to Current Year To test the data validation, enter a date that is not in the current year.
Read more >Date and Time validation not working - ServiceNow Community
I am looking to validate the date and time field on a catalog item. I am using the script below but for some...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

You may specify a boolean for the last argument to use strict parsing. Strict parsing requires that the format and input match exactly, including delimiters.
https://day.js.org/docs/en/parse/string-format
Cool! I’ll close this issue since it’s been solved. Feel free to reopen if you have updates on this