0

Currently I had problem to validate date of the forms page.

I use date picker form input.

But when user sets date manually (input by keyboard), that date picker still allows wrong dates such as 2016-02-31 (which not existed). Date picker never complains about that.

So how can I validate a date(string) with jQuery or javascript?

abarisone
  • 3,707
  • 11
  • 35
  • 54
  • 1
    this solution solved my problem. http://stackoverflow.com/questions/8098202/javascript-detecting-valid-dates – Irfandi Achmad May 31 '16 at 06:20
  • 1
    Possible duplicate of [Detecting an "invalid date" Date instance in JavaScript](http://stackoverflow.com/questions/1353684/detecting-an-invalid-date-date-instance-in-javascript) – AL. May 31 '16 at 06:31

1 Answers1

0

2016-02-31 is handled as 2016-03-02, so you just have to compare, whether the date string is equal to the input.

Pavel Gatnar
  • 3,987
  • 2
  • 19
  • 29