Skip to content

feat: Add lenient validation of the date parsing #2873

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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

8o8inCodes
Copy link

This pull request is aiming to add validation to the lenient dates (Issue)

Current issue:

dayjs('2025-13-36T14:19:39') // note that the month is 13 and day is 36
// output: Thu, 05 Feb 2026 12:19:39 GMT
// which calculates a new date using the remainders from days and months.

This PR adds another option called "lenientValidation", where if you will submit such case, you will get a new dayjs invalid instance.

const badDate = dayjs('2025-13-36T14:19:39') // note that the month is 13 and day is 36
badDate.isValid();
// output: False

If you have better name for this option, feel free to suggest. I hope this PR is helpful.

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

Successfully merging this pull request may close these issues.

1 participant