Bootstrap 3 datepicker internalization -
i'm using code create booking system:
this example working fine, can't add internalization , others option.
i tried sample code:
$('#dpd1').datepicker({ language: 'it' }); $('#dpd1').datepicker({ format: "dd-mm-yyyy", weekstart: 1, language: "fr", autoclose: true, todayhighlight: true }); $('#dpd2').datepicker({ format: "dd-mm-yyyy", weekstart: 1, language: "fr", autoclose: true, todayhighlight: true }); $(window).load(function(){ var nowtemp = new date(); var = new date(nowtemp.getfullyear(), nowtemp.getmonth(), nowtemp.getdate(), 0, 0, 0, 0); var checkin = $('#dpd1').datepicker({ onrender: function(date) { return date.valueof() < now.valueof() ? 'disabled' : ''; } }).on('changedate', function(ev) { if (ev.date.valueof() > checkout.date.valueof()) { var newdate = new date(ev.date) newdate.setdate(newdate.getdate() + 1); checkout.setvalue(newdate); } checkin.hide(); $('#dpd2')[0].focus(); }).data('datepicker'); var checkout = $('#dpd2').datepicker({ onrender: function(date) { return date.valueof() <= checkin.date.valueof() ? 'disabled' : ''; } }).on('changedate', function(ev) { checkout.hide(); }).data('datepicker'); });
adding:
<script src="http://eternicode.github.io/bootstrap-datepicker/bootstrap-datepicker/js/locales/bootstrap-datepicker.fr.js"></script>
the same using this:
$(document).ready(function(){ $.fn.datepicker.defaults.language = 'it'; });
this error: typeerror: $.fn.datepicker.dates undefined
you have include french language file , try use italian language...
Comments
Post a Comment