Bootstrap 3 Datetimepicker 3.0.0 - 从星期一开始一周 [英] Bootstrap 3 Datetimepicker 3.0.0 - make a week start on Monday
问题描述
我使用 Bootstrap 3 的几个原因 Datetimepicker 3.0.0在我的 MVC 5 项目中.
There are few reasons I use Bootstrap 3 Datetimepicker 3.0.0 in my MVC 5 project.
知道如何抵消从星期一开始的一周开始吗?语言标签也不起作用.
Any idea how to offset week start so it starts from Monday? Language tag also not working.
$(function () {
$('#PickupTime').datetimepicker({
weekStart: 1
});
});
这不起作用,因为它不是同一个 bootstrap-datapicker.js
This is not working because it is not the same bootstrap-datapicker.js
推荐答案
我没有使用 moment.js,而是使用了 moment-with-langs.js(我猜它带有默认包 ASP.NET MVC 5).
Instead of using moment.js I used moment-with-langs.js (I guess it came with default package ASP.NET MVC 5).
通过调用:
<script type="text/javascript">
$('#DateTime').datetimepicker({
language: "hr"
});
</script>
一切顺利,日历终于从星期一开始了.
thing works, finally the calender starts from monday.
更新:更好的是,将密钥添加到 web.config
UPDATE: Even better, add key to web.config
<appSettings>
<add key="Culture" value="hr" />
</appSettings>
然后
$(document).ready(function () {
$(document).on('focus', '#Date', function () {
$(this).datetimepicker({
locale: '@System.Configuration.ConfigurationManager.AppSettings["Culture"]',
format: 'DD:MM:YYYY',
});
});
});
这篇关于Bootstrap 3 Datetimepicker 3.0.0 - 从星期一开始一周的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!