Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit c15dcbd

Browse files
committed
feat(datepicker): add helpers for styling
- Add helper variables available for custom templates to hook into for styling Closes #5580
1 parent 4b06b0b commit c15dcbd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/datepicker/datepicker.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -310,12 +310,17 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
310310
this.createDateObject = function(date, format) {
311311
var model = ngModelCtrl.$viewValue ? new Date(ngModelCtrl.$viewValue) : null;
312312
model = dateParser.fromTimezone(model, ngModelOptions.timezone);
313+
var today = new Date();
314+
today = dateParser.fromTimezone(today, ngModelOptions.timezone);
315+
var time = this.compare(date, today);
313316
var dt = {
314317
date: date,
315318
label: dateParser.filter(date, format),
316319
selected: model && this.compare(date, model) === 0,
317320
disabled: this.isDisabled(date),
318-
current: this.compare(date, new Date()) === 0,
321+
past: time < 0,
322+
current: time === 0,
323+
future: time > 0,
319324
customClass: this.customClass(date) || null
320325
};
321326

0 commit comments

Comments
 (0)