我在我的代码中使用bootstrap datepicker但是出现的日历有几个月像#34; March"," July"是否有任何方法可以将月份全名更改为" MAR"," JUL"。 提前致谢 See the image 在这,我希望八月成为AUG
答案 0 :(得分:3)
转换为您想要的任何内容:
...只需在$ .fn.datepicker.dates中添加一个键, 在调用.datepicker()docs
之前
$.fn.datepicker.dates['en'] = {
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
};
http://bootstrap-datepicker.readthedocs.io/en/latest/i18n.html
更改语言:
$('.datepicker').datepicker({
language: "pt-BR"
});
答案 1 :(得分:0)
由于您在评论中说明您使用的是eonasdan datetimepicker,因此您只需使用dayViewHeaderFormat
选项即可。
这是一个有效的例子。
$('#datetimepicker1').datetimepicker({
format: 'L',
dayViewHeaderFormat: 'MMM YYYY'
});

<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet"/>
<link href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/css/bootstrap-datetimepicker.css" rel="stylesheet"/>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment-with-locales.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/js/bootstrap-datetimepicker.min.js"></script>
<div class="input-group date" id="datetimepicker1">
<input type="text" class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
&#13;