Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How do i write a try and catch block to raise an exception when the entered date is invalid in jquery.

What I have tried:

It will be a big help if you can try and answer this question.
Posted
Updated 14-May-17 23:51pm

1 solution

You can make use of Moment.js[^]. It has .isValid() to check if the date is valid or not.

e.g.
C#
moment("12/12/2016", "MM/DD/YYYY").isValid();//true
moment("13/12/2016", "MM/DD/YYYY").isValid();//false

Apart from this,have a look at : jquery - JavaScript Detecting Valid Dates - Stack Overflow[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900