Reputation: 1049
I'm trying to localize jquery datepicker but since I'm not an expert in jquery I get an error and I don't know how to fix it.
Error
TypeError: 'undefined' is not an object (evaluating '$.ui.datepicker.regional')
Here is the code of datepicker
calendar.js
$(function() {
$( ".from" ).datepicker({
defaultDate: "+1w",
dateFormat: "dd/mm/yy",
changeMonth: true,
numberOfMonths: 1,
onClose: function( selectedDate ) {
$( ".to" ).datepicker( "option", "minDate", selectedDate );
}
});
$( ".to" ).datepicker({
defaultDate: "+1w",
dateFormat: "dd/mm/yy",
changeMonth: true,
numberOfMonths: 1,
onClose: function( selectedDate ) {
$( ".from" ).datepicker( "option", "maxDate", selectedDate );
}
});
});
and the localization
<script src="//jquery-ui.googlecode.com/svn-history/r3875/branches/labs/datepicker2/ui/i18n/jquery.ui.datepicker-it.js" ></script>
Both of them come after the following code
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
Upvotes: 0
Views: 2676
Reputation: 20636
Refer this Link - Datepicker Localize
$(function() {
$( ".from" ).datepicker( $.datepicker.regional[ "it" ] );
$( ".to" ).datepicker( $.datepicker.regional[ "it" ] );
});
Use the below script tag for reference.
<script src="http://jquery-ui.googlecode.com/svn/tags/1.8.20/ui/i18n/jquery.ui.datepicker-it.js" ></script>
$.datepicker.regional[ "it" ]
to apply localize settings.Upvotes: 2