Set Default Date Bootstrap Datepicker

前端 未结 9 1280
暗喜
暗喜 2021-02-12 14:15

How to set a default date in Bootstrap Datepicker?

I want to set a date : 24/12/2006

When I open datepicker it should show me this date select on calender.

9条回答
  •  孤独总比滥情好
    2021-02-12 15:07

    If you want to make the change global, look for the following in bootstrap-datepicker.js:

    function UTCToday(){
    var today = new Date();
    return UTCDate(today.getFullYear(), today.getMonth(), today.getDate());
    

    and hard code in your date, for example:

    function UTCToday(){
    var today = new Date();
    return UTCDate(2006, 00, 01);
    

    Which will open on 1 January 2006. Note that for some reason January is '00' rather than '01'.

提交回复
热议问题