Is it possible to validate an regular text input as a readable date format, such as November 25, 2019? This is because I'm using a javascript date picker, however the user can still enter whatever they want.
I'm guessing this could be done use some regular expression but wondering if there is another function or solution?
I guess you could split this in 3 parts, the first part would have to be 1 of 12 month spellings, while the day would have to be 1 of 31 followed by a comma and then the year would have to validate as something between 1000 & 9999.
So far this is where I'm headed
var dateval = $('#' + formId + ' input[name=date]').val();
var res = dateval.split(" ",3);
var d1 = res[0];
var d2 = res[1];
var d3 = res[2];
var montharray = ['Januaray','February'];
var dayarray = ['1,','2,'];
if($.inArray(d1,montharray) !== -1){
alert('good month');
}
if($.inArray(d2,dayarray) !== -1){
alert('good day');
}