I am using the Bootstrap
datepicker
and the following is my jQuery
code:
$('.form_date').datetimepicker({
language: 'en',
/* endDate: '+0d', */
startDate: '+1d',
weekStart: 1,
autoclose: 1,
startView: 2,
format: 'dd/mm/yyyy',
minView: 2,
forceParse: 0,
});
The following is what I get:
I want have the start date highlighting on tomorrow according to our requirement. I have found one option defaultViewDate
on the Bootstrap
datepicker
documentation. (http://bootstrap-datepicker.readthedocs.org/en/latest/options.html)
It states that I have to set the year
, month
, and day
key of defaultViewDate
. But I don't know how to set it.
Try following;
$('.form_date').datetimepicker({
defaultViewDate: { year: 1977, month: 04, day: 25 }
});
It should be in the format of Object with year, month and day keys. For more information please see here;
https://eternicode.github.io/bootstrap-datepicker
Your format for the startDate
option looks correct, but I do see some other errors in your JavaScript that may be confusing the DatePicker
(and causing your startDate
to be ignored):
- The
autoclose
option should be formatted as a Boolean
and should be either true
or false
.
- The
minView
option that you have defined should actually be: minViewMode
.
- The
forceParse
option should be formatted as a Boolean
and should be either true
or false
.
- You have a trailing comma that follows your final option (
forceParse
), which should be removed so that there is no comma after the final option.
If you correct the problems listed above, I believe you will begin to see a correct startDate
.