I would like to check if the date format is (dd/mm/yyyy) before the post is made in a JavaScript (jQuery).
How could I achieve that?
I would like to check if the date format is (dd/mm/yyyy) before the post is made in a JavaScript (jQuery).
How could I achieve that?
You can use a regex:
/^\d{2}\/\d{2}\/\d{4}$/.test(str)
Of course this will not check for a valid date, but in that case you can always let your server-side code throw an error. If you want more client-side validation have a look at Javascript: how to validate dates in format MM-DD-YYYY?; it is easy to adapt to your format.
i think that would be very difficult, considering the ambiguity for cases where the date is less than equal to 12