From c15dcbd1d160fcd22feda86cc3b352bd1331805a Mon Sep 17 00:00:00 2001 From: Wesley Cho Date: Thu, 3 Mar 2016 15:51:00 -0800 Subject: [PATCH] feat(datepicker): add helpers for styling - Add helper variables available for custom templates to hook into for styling Closes #5580 --- src/datepicker/datepicker.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/datepicker/datepicker.js b/src/datepicker/datepicker.js index 07d9feff83..f6df0f9536 100644 --- a/src/datepicker/datepicker.js +++ b/src/datepicker/datepicker.js @@ -310,12 +310,17 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst this.createDateObject = function(date, format) { var model = ngModelCtrl.$viewValue ? new Date(ngModelCtrl.$viewValue) : null; model = dateParser.fromTimezone(model, ngModelOptions.timezone); + var today = new Date(); + today = dateParser.fromTimezone(today, ngModelOptions.timezone); + var time = this.compare(date, today); var dt = { date: date, label: dateParser.filter(date, format), selected: model && this.compare(date, model) === 0, disabled: this.isDisabled(date), - current: this.compare(date, new Date()) === 0, + past: time < 0, + current: time === 0, + future: time > 0, customClass: this.customClass(date) || null };