Skip to content

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