I would like to test if a date and or time entered is valid.
Can this be done with moment as date and time testing with javascript seems a nightmare. (have spent hours on this).
Test data looks like this.
Invalid
invalid = ""
invalid = " "
invalid = "x"
invalid = "1/1"
invalid = "30/2/2015"
invalid = "2/30/2015"
Is Valid
isvalid = "1/12/2015"
isvalid = "1/12/2015 1:00 PM";
Have tried various javascript methods with hours of trials failing.
I thought moment would have something for this. So tried the following, all of which does not work because I do no think moment works like this.
var valid = moment(input).isDate()
var valid = moment().isDate(input)
My time format is "dd/mm/yyyy"