1
- angular . module ( 'ui.bootstrap.datepicker' , [ 'ui.bootstrap.position' ] )
1
+ angular . module ( 'ui.bootstrap.datepicker' , [ 'ui.bootstrap.dateparser' , 'ui.bootstrap. position'] )
2
2
3
3
. constant ( 'datepickerConfig' , {
4
4
formatDay : 'dd' ,
@@ -430,8 +430,8 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.position'])
430
430
showButtonBar : true
431
431
} )
432
432
433
- . directive ( 'datepickerPopup' , [ '$compile' , '$parse' , '$document' , '$position' , 'dateFilter' , 'datepickerPopupConfig' ,
434
- function ( $compile , $parse , $document , $position , dateFilter , datepickerPopupConfig ) {
433
+ . directive ( 'datepickerPopup' , [ '$compile' , '$parse' , '$document' , '$position' , 'dateFilter' , 'dateParser' , ' datepickerPopupConfig',
434
+ function ( $compile , $parse , $document , $position , dateFilter , dateParser , datepickerPopupConfig ) {
435
435
return {
436
436
restrict : 'EA' ,
437
437
require : 'ngModel' ,
@@ -489,7 +489,6 @@ function ($compile, $parse, $document, $position, dateFilter, datepickerPopupCon
489
489
datepickerEl . attr ( 'date-disabled' , 'dateDisabled({ date: date, mode: mode })' ) ;
490
490
}
491
491
492
- // TODO: reverse from dateFilter string to Date object
493
492
function parseDate ( viewValue ) {
494
493
if ( ! viewValue ) {
495
494
ngModel . $setValidity ( 'date' , true ) ;
@@ -498,7 +497,7 @@ function ($compile, $parse, $document, $position, dateFilter, datepickerPopupCon
498
497
ngModel . $setValidity ( 'date' , true ) ;
499
498
return viewValue ;
500
499
} else if ( angular . isString ( viewValue ) ) {
501
- var date = new Date ( viewValue ) ;
500
+ var date = dateParser . parse ( viewValue , dateFormat ) || new Date ( viewValue ) ;
502
501
if ( isNaN ( date ) ) {
503
502
ngModel . $setValidity ( 'date' , false ) ;
504
503
return undefined ;
0 commit comments