jquery ui datepicker - setting the regional attribute changes the date value.
Hello,
I'm trying to use the JQuery UI Datepicker. It works well except for
this one problem. I'm trying to use localization by assigning the
locale code as shown in the code below. This also works fine as far
as localizing the calendar itself. However, if I assign a value to
the date textbox beforehand on server side, the second statement in
the code below (the one which sets the regional attribute), changes
the date to something else.
For example, if I am setting the value of the textbox to 8/10/2009 on
the server side, it will change the value to 10/20/2008. If I set the
value to 9/11/2009, it will change the value to 11/20/2009. It seems
it takes the month and sets it to year, and takes the month and
changes it to day. This only happens if I do localization. If I
delete the second statement, then this works fine. BTW, this happens
for both french and english, so It's not like it works for one locale
and not for the other one. Also, this doesn't happen if I don't set
the value of the textbox beforehand.
Thanks in advance.
Code:
$("#<%=txtDate.ClientID%>").datepicker({ altFormat: 'mm/dd/yy',
showOn: 'button', buttonImage: '/images/calendar.gif',
buttonImageOnly: true, altField: '#<%=txtDate.ClientID%>' });
$("#<%=txtDate.ClientID%>").datepicker('option', $.extend
($.datepicker.regional[locale]));