0

I want to my calendar week start with monday. Im using Bootstrap Datetimepicker, but I don't know how to do that. There's my JSFiddle.

This is my jQuery for datetimepicker

$(function () {
    $('.datetimepickerinline').datetimepicker({
      inline: true
  });
  $('.datetimepickerinline').on('change dp.change', function(e){
    $('input').val($(this).data('date'));
  });
});

I cant find any solutions in documentation, that's why Im asking it there :)

eatmailyo
  • 670
  • 1
  • 12
  • 33
  • Switch to [bootstrap-datetimepicker](https://github.com/smalot/bootstrap-datetimepicker)! It's having plenty of options to customize – Dhaval Marthak Nov 22 '16 at 10:22
  • your HTML markup is wrong, you don't need JS for setting it. It's literally in the documentation. Your title of the question also differs to the actual question. – zerohero Nov 22 '16 at 10:23
  • @tejashsoni111 that solution doesnt work for me. if you can add to my code, then thats gonna be nice :) – eatmailyo Nov 22 '16 at 10:24
  • @DanielsJirgensons, check out this fiddle [https://jsfiddle.net/ekm0on2a/16/](https://jsfiddle.net/ekm0on2a/16/). I used the same solution provided at [http://stackoverflow.com/questions/24410685/bootstrap-3-datetimepicker-3-0-0-week-starts-at-monday](http://stackoverflow.com/questions/24410685/bootstrap-3-datetimepicker-3-0-0-week-starts-at-monday) – tejashsoni111 Nov 22 '16 at 10:26
  • @tejashsoni111 oh, nice. write this at answer, that I can mark as answered :) – eatmailyo Nov 22 '16 at 10:27
  • @DanielsJirgensons note that the datetimepicker allows localization, if you add the [`locale`](https://eonasdan.github.io/bootstrap-datetimepicker/Options/#locale) option you will have the calendar according the given locale. If you just need to change the start of the week, change moment `dow` setting for english locale as suggested in the linked answer. – VincenzoC Nov 22 '16 at 10:38

2 Answers2

3

You have to make changes for the moment js option as implemented in answer here : Bootstrap 3 Datetimepicker 3.0.0 - week starts at Monday

JSFIDDLE : https://jsfiddle.net/ekm0on2a/16/

$(function () {
    moment.locale('en', {
        week: { dow: 1 } // Monday is the first day of the week
    });
    $('.datetimepickerinline').datetimepicker({
          inline: true
      });
      $('.datetimepickerinline').on('change dp.change', function(e){
        $('input').val($(this).data('date'));
      });
});
Community
  • 1
  • 1
tejashsoni111
  • 1,405
  • 1
  • 18
  • 34
1

You could set the locale to the correct value, so everyone should have it correct in their country.

$('.datetimepickerinline').datetimepicker({
   inline: true,
   locale: 'de'
});

Setting that to germany, the week starts with monday and also the text is in german.

PKeidel
  • 2,559
  • 1
  • 21
  • 29