I have a date format that is a one digit month (no leading zero), followed by a two digit day and 2 digit year.
January 1st, 2013 = 10113
I’m trying to attach a datepicker with the correct format to it but it doesn’t format correctly.
<input type="text" id="date" value="10113">
$("#date").datepicker({ dateFormat: 'mddy'});
When the date picker pops up it has the date Oct 11, 2003.
Unfortunately, your format won’t work. if you look at the implementation of
datepickerformatDate, you can see that formit will try to match 1 or 2 digits, because it can’t tell that you mean January and not October ahead of time,This method is being called like this, getNumber(‘m’):
as you can see size will be 2 for ‘m’, therefore it will match 2 digits! When in doubt put break points in the code and see what happens (that’s what I just did, using chrome developer tools)