我想更改日期选择器的语言。这是我的代码:
$("#datepicker-month").datepicker({
locale: 'fr',
dateFormat: 'mm-yy',
format: 'yyyy-mm',
viewMode: "months",
minViewMode: "months",
autoclose: true,
language: "fr",
regional: "fr",
});
但是不幸的是我得到了这个:
能帮我吗?
答案 0 :(得分:0)
使用当地语言重命名所有名称。
$(document).ready(function(){
$.fn.datepicker.dates['fr'] = {
days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
today: "Today",
clear: "Clear",
format: "mm/dd/yyyy",
titleFormat: "MM yyyy", /* Leverages same syntax as 'format' */
weekStart: 0
};
$("#datepicker-month").datepicker( {
format: "mm-yyyy",
viewMode: "months",
minViewMode: "months",
language: "fr"
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/css/bootstrap-datepicker.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/js/bootstrap-datepicker.min.js"></script>
<input type="text" id="datepicker-month" />
答案 1 :(得分:0)
尝试一下
$('#datepicker').datepicker( $.datepicker.regional[ "fr" ] );