简体   繁体   中英

bootstrap-datepicker set startDate and EndDate

I am using http://vitalets.github.io/bootstrap-datepicker/ bootstrap datepicker for user to select there date of birth, all user are above 60, I want to allow them to select year first, then month and date, this plugin support year first, but its showing 2014 when datapicker if focus, I want default selected to be 1950,

 <script>
    $(document).ready(function () {
        var currDate = 1;
        var currMonth = 1;
        var currYear = 1950;
        var dateStr = new Date(currMonth + "/" + currDate + "/" + currYear);

        $("#DOB").datepicker({
            viewMode: 'years',
            startDate : dateStr
        });
    });
</script>

There is an option available in the provided link itself-> startView

Syntax: startView : 'decade'

Description :

The view that the datepicker should show when it is opened. Accepts values of 0 or 'month' for month view (the default), 1 or 'year' for the 12-month overview, and 2 or 'decade' for the 10-year overview.

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