Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set the first day and weeks for Bootstrap Datepicker

I'm new to this: I'm playing with Bootstrap Datepicker and have got it to work with

$(document).ready(function () {
  $('#datepickeron').datepicker()
});

And then a

<div id="dateoickeron"></div>

But I can't set first day or weeks like in jQuery UI. Normally I can use firstDay: 1, weekHeader: "Uge", showWeek: true like in jQuery UI and show 3 months like numberOfMonths: [3, 1], stepMonths: 3.

How do I do this for the Bootstrap Datepicker?

like image 326
Thomas BP Avatar asked Aug 27 '12 14:08

Thomas BP


People also ask

How do I change the default date in datepicker?

Syntax: $(". selector"). datepicker( {defaultDate:"+6"} );

How do I change the date format in bootstrap?

In order to set the date format, we only need to add format of one argument and then we will add our required format, which is shown in the following example: Example 1: In this example, we are going to use dd-mm-yyyy format.

What is Bootstrap date picker?

Bootstrap Date Picker Bootstrap date picker is a plugin that adds the function of selecting time without the necessity of using custom JavaScript code. This documentation may contain syntax introduced in the MDB 4.17.0 and can be incompatible with previous versions. For old Date Picker documentation please follow the link.

What is the default setting for datepicker?

Default: 0, “days” The view that the datepicker should show when it is opened. Accepts: 0 or “days” or “month”, 1 or “months” or “year”, 2 or “years” or “decade”, 3 or “decades” or “century”, and 4 or “centuries” or “millenium”.

How do I initialize a datepicker lazily?

For most datepickers, simply set data-provide="datepicker" on the element you want to initialize, and it will be intialized lazily, in true bootstrap fashion. For inline datepickers, use data-provide="datepicker-inline"; these will be immediately initialized on page load, and cannot be lazily loaded.

What versions of bootstrap-datepicker are tested against?

Bootstrap-datepicker provides a flexible datepicker widget in the Bootstrap style. Versions are incremented according to semver. jQuery 1.7.1+ These are the specific versions bootstrap-datepicker is tested against ( js files) and built against ( css files).


1 Answers

Try adding weekStart . Visit here for more details about it

$(document).ready(function () {
 $('#datepickeron').datepicker({
   weekStart: 0 // day of the week start. 0 for Sunday - 6 for Saturday
 });
});
like image 100
agriboz Avatar answered Oct 19 '22 19:10

agriboz