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;
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):
autoclose
option should be formatted as a Boolean
and should be either true
or false
. minView
option that you have defined should actually be: minViewMode
. forceParse
option should be formatted as a Boolean
and should be either true
or false
. 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
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.