Strictly parsing dates with moment

Viewed 2038

When you create a moment from a date string and pass in the format, moment very loosely checks the date string against the format. for example the following dates are all valid

moment('1','YYYY-MM-DD').isValid() //true
moment('1988-03','YYYY-MM-DD').isValid() //true
moment('is a val1d date!?#!@#','YYYY-MM-DD').isValid() //true

Is there any way to only accept dates that match the specified format?

1 Answers
Related