简体   繁体   中英

bootstrap-datepicker start date limit

I am using bootstrap date picker ( http://www.eyecon.ro/bootstrap-datepicker ). I would like to set start limit of datepicker (I want to restrict going back date from today.). I have read documentation and related answers on stackoverflow ( Bootstrap DatePicker, how to set the start date for tomorrow? ) but could not set start date.

My codes:

Html:

<input name="endDate" class="datepicker form-control pull-right" data-date-format="dd.mm.yyyy" value="19.05.2016">

Javascript:

$('.datepicker').datepicker({
    language: 'tr',
    autoclose: true,
    startDate: '+1d' //for just test
});

It is working correctly, but you just don't see it because you are on next month. Check this fiddle

By setting value="19.05.2016" you set the default selected day to 19.05.2016, thus you are on May motnh tab. The option startDate: '+1d' set the default selectable period to start from +1d from today . That's pretty clear in the Fiddle, if you look at what date is set as value and how many days are added in startDate option.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM