You don't need to do that when using HTML 5 type="date" attribute (the format then will be forced to be YYYY-MM-DD).
When setting a date, without specifying the time zone, Java Script will use the browser's time zone.When getting a date, without specifying the time zone, the result is converted to the browser's time zone.developer.mozilla.org/en-US/docs/Web/Java Script/Reference/… Would like to mention that the j Query UI Date Picker widget has a very good date validator utility method that checks for format and validity (e.g., no 01/33/2013 dates allowed).Even if you don't want to use the datepicker widget on your page as a UI element, you can always add its library to your page and then call the validator method, passing the value you want to validate into it.If you are passing in a string to the date constructor, you must pass in a standardised string to get a reliable result.
Specifically, "The string should be in a format recognized by the Date.parse() method".
There is no single format that is parsed correctly in popular browsers, much less all those in use (though eventually the ISO8601 format specified in ES5 should be ok).
Try this in chrome - Object.String.call(new Date("2013-07-09T:9Z")). According to you, therefore, "2013-07-09T:9Z", should be a valid date. You can verify it, again in chrome, by doing var date Str = new Date("2013-07-09T:9Z"); date Str It will return invalid date..
When I try to validate a date, it will either accept the manual date, or the calendar date but never both. ) (or prevent them from typing anything other than dd/mm/yyyy) ('ve tried regular expressions but it does not accept the value from the calendar) Thanks hopefully!
Now you can ask questions directly to me on my new site ASPForums.
Validation can be defined by many different methods, and deployed in many different ways.