简体   繁体   中英

How to highlight custom date in bootstrap date picker

Im using angularjs for my project and bootstrap date-picker for select date. In my project there is 2 input for select From date and To date. For the From date can select only today date, for the To date calculation i have add 1 year for from date using JavaScript and bind to To Date input. Data binding part is working fine. but when i click on To date its not show highlighted date in date-picker. Can i know how to highlight Today.

These are the option currently im used.

 autoclose: true,
 todayHighlight: true   

在此处输入图片说明

In HTML You can use this.

<input name="dateInput" type="date" ng-model="TodayDate"/>

And In Controller you can get new Date(), So You can Assign the date to the ng-model.

var d = new Date();
var year = d.getFullYear();
var month = d.getMonth() + 1;
if (month < 10){
    month = "0" + month;
};
if (day < 10) {
    day = '0' + day;
}
$scope.TodayDate = year + "-" + month + "-" + day;

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