I am trying to build a function that changes the language of date picker
$(function(){
txtDate = $("#txtDate");
var minDate = new Date(2011, 1 - 1, 15);
var maxDate = new Date(2011, 6 - 1, 15);
txtDate.date
txtDate.dateEntry({
defaultDate: maxDate,
minDate: minDate,
maxDate: maxDate,
spinnerImage: ''
});
txtDate.datepicker({
minDate: minDate,
maxDate: maxDate
});
txtDate.datepicker("setDate", maxDate);
dateLanguageChange();
});
var dateLanguageChange = function () {
$("#txtDate").datepicker("destroy").datepicker($.datepicker.regional["fr"]);
};
html:
<div class="form-row">
<label>@Html.Resource("Date")</label>
<input id="txtDate" type="text" class="date-box" />
</div>
have you tried using jQuery UI Datepicker It's a highly configurable plugin and provides support for localizing its content to cater for different languages and date formats.
$(function() {
$("#txtDate").datepicker({
dateFormat: 'dd/mm/yy',
minDate: '-10y',
maxDate: 'now',
changeMonth: true,
changeYear: true,
firstDay: 1
});
$.datepicker.setDefaults($.datepicker.regional['fr']);
});
your html
<input id="txtDate" type="text" class="date-box" />
Note:configure datepicker options accordingly....make sure to include jquery.ui.datepicker-fr.js Hope it helps!!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With