Im using jQuery.validity plugin to validate PHP form.
I need to validate whether the input date format is in dd-MMM-yyyy, but the plugin default is mm/dd/yyyy.
When I use this code,
$("#txtFromDate")
.require()
.match("date")
.lessThanOrEqualTo(new Date());
it asks to enter date in its default format.
How to change the input date format to dd-MMM-yyyy (eg: 01-FEB-2012)?
I found this code to change the date format of input string for jQuery.validity plugin
$.extend($.validity.patterns, {
date:/^\d\d-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)(-\d{4})?$/
});
NOTE:
I had to remove the checking of the input date with current date .lessThanOrEqualTo(new Date());
as it always returned false. It seems above code does not change the format for the current date checking...