This project is read-only.

Upgrade to 2.4 causes Date inputs to not work

Apr 10, 2013 at 2:10 AM
Edited Apr 10, 2013 at 2:52 AM
Hi, I've just upgraded from 2.2.4 to 2.4 and after doing so the date time inputs are outputing the date in US format. I have my culture set to "en-NZ" which I have being doing so for over a year now with no issues...but as of yesterday the cultures are all showing MM/d/yyyy as the format.

I've checked your Demo code as well and it doesn't work either. If you set the culture to en-NZ which has a date format of d/MM/yyyy and enter your birth date as 10 April 2013 it returns 04/10/2013 instead of 10/04/2013.

Do you know of any upgrade changes that could have caused this? I see you upgraded jQuery to 1.7 as well.


Apr 10, 2013 at 8:55 AM
Hi Craig,_
dont worry there is no bug :). Just substitute:
Html.JQueryDatePickerGlobalizationScript(null, "~/Scripts/cultures/datepicker/")
Html.JQueryDatePickerGlobalizationScript(null, "~/Scripts/cultures/datepicker/", x => true)
We added support for falling back in the case the culture required by the user is not contained in the system. Now as default, for en english user the date time picker just uses the en culture without considerin the country. The third optional argument , if provided, is a function that specify the cultures that it must consider also the country.

For instance, in you case it uses the en instead of the en-NZ culture....that result wrong...HOWEVER if you spefify the third parameter, this function will receive the current culture string as parameter, that is "en-NZ". Now if after processing the parameter the function returns true, the country is considered too. In the snipped I provided, the function always return the country is always considered.

the default is x => false, because this works better for must of cultures :) However you can do a very complex function that verifies an array with all available cultures, and then decided the best strategy. We added also the LocalizableResourceScript helper to help in handling cultures with fallback...

Sorry I forgot to update the documentation about this new features...I will do it providing also some usefull example of globalization strategy.
Apr 10, 2013 at 8:45 PM
Once again you are proved a legend.