Reputation: 1401
I am not able to validate the given date. I have multiple time formats options.
moment("10/4/2013 01:00",["DD-MMM-YYYY HH:mm:ss", "DD-MMM-YYYY HH:mm", "MM/DD/YYYY HH:mm"]).isValid();
However it is valid when,
moment("10/4/2013 01:00",["MM/DD/YYYY hh:mm"]).isValid();
It becomes invalid again when I add a three letter month format
moment("10/4/2013 01:00",["DD-MMM-YYYY HH:mm", "MM/DD/YYYY HH:mm"]).isValid();
The two formats in the line above are totally different however moment
is not parsing the date.
I want to validate the date in either formats.
Upvotes: 0
Views: 143
Reputation: 2953
validation with multiple formats seems to check if string is valid in every format.
I would simply do a function to iterate on formats and check if date is at least valid with one of them instead;
Upvotes: 0