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 w
I have just done! In moment.js change this line:
_week : {
dow : 1, // Sunday is the first day of the week.
doy : 6 // The week that contains Jan 1st is the first week of the year.
},
'dow' MUST BE 1 and the week starts at Monday.
Instead of using moment.js I used moment-with-langs.js (I guess it came with default package ASP.NET MVC 5).
By calling:
<script type="text/javascript">
$('#DateTime').datetimepicker({
language: "hr"
});
</script>
thing works, finally the calender starts from monday.
UPDATE: Even better, add key to web.config
<appSettings>
<add key="Culture" value="hr" />
</appSettings>
and then
$(document).ready(function () {
$(document).on('focus', '#Date', function () {
$(this).datetimepicker({
locale: '@System.Configuration.ConfigurationManager.AppSettings["Culture"]',
format: 'DD:MM:YYYY',
});
});
});
I stumbled upon the same question, and i'm using:
And, following the answer of user3928861 I found the answer on line 961 of moment.js as follows:
var defaultLocaleWeek = {
dow : 1, // Sunday is the first day of the week.
doy : 6 // The week that contains Jan 1st is the first week of the year.
};
'locale' => [
'firstDay' => 1
]
open jquery.datetimepicker.js and find variable "dayOfWeekStart" and set it to 1
If you are using moment.js from v2.8.1 onwards, add the below code before calling datetimepicker().
moment.updateLocale('en', {
week: { dow: 1 } // Monday is the first day of the week
});
$('#DateTime').datetimepicker();
If you are using old version of moment.js, do the following
moment.lang('en', {
week: { dow: 1 }
});
$('#DateTime').datetimepicker();