I’m having a lot of trouble with a jQueryUI DatePicker.
Whenever it loses focus, the background of the TextBox turns a light shade of red (presumably indicating an invalid date).
It is doing this even when the date is valid (en-AU).
I have written the following code:
$(function () {
$('.date').each(function () {
$(this).datepicker({
dateFormat: 'dd/mm/yy',
showOn: "both",
buttonImage: '/Content/calendar.gif',
buttonImageOnly: true
});
});
});
I also looked at this page, which does not seem to work: http://jqueryui.com/datepicker/#localization
If you set the textbox on the right to English-Australian, then select a date, it is still in the US format.
I also tried adding:
$(this).datepicker($.datepicker.regional['en-AU']);
Any thoughts would be appreciated.
Cheers
I have run into this problem in the past.
You need to add a javascript file for localization to work properly.
Here is a list of all the localization files: http://view.jqueryui.com/selectmenu/ui/i18n/ . Make sure to add it to your
<head>and you should be good to go.Hope this helps!
EDIT:
Use this link for the localization script:
http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/i18n/jquery-ui-i18n.min.js
I have also provided a demo:
http://jsfiddle.net/93RGW/139/