Bootstrap 3 Datetimepicker 3.0.0 - make a week start on Monday

HerGiz picture HerGiz · Jun 25, 2014 · Viewed 24.4k times · Source

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
    });
 });

This is not working because it is not the same bootstrap-datapicker.js

Answer

justinw picture justinw · Jul 18, 2015

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();