Skip to content

Commit 81f8ee4

Browse files
committed
fix(datepicker): ng-model value can be a timestamp
Accept a number of milliseconds since 01.01.1970 as a valid value for `ng-model` Closes angular-ui#2345
1 parent 23936f9 commit 81f8ee4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: src/datepicker/datepicker.js

+5
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,11 @@ function ($compile, $parse, $document, $position, dateFilter, dateParser, datepi
502502
}
503503

504504
function parseDate(viewValue) {
505+
if (angular.isNumber(viewValue)) {
506+
// presumably timestamp to date object
507+
viewValue = new Date(viewValue);
508+
}
509+
505510
if (!viewValue) {
506511
ngModel.$setValidity('date', true);
507512
return null;

0 commit comments

Comments
 (0)