1- angular . module ( 'ui.bootstrap.datepicker' , [ 'ui.bootstrap.position' ] )
1+ angular . module ( 'ui.bootstrap.datepicker' , [ 'ui.bootstrap.dateparser' , 'ui.bootstrap. position'] )
22
33. constant ( 'datepickerConfig' , {
44 formatDay : 'dd' ,
@@ -430,8 +430,8 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.position'])
430430 showButtonBar : true
431431} )
432432
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 ) {
435435 return {
436436 restrict : 'EA' ,
437437 require : 'ngModel' ,
@@ -489,7 +489,6 @@ function ($compile, $parse, $document, $position, dateFilter, datepickerPopupCon
489489 datepickerEl . attr ( 'date-disabled' , 'dateDisabled({ date: date, mode: mode })' ) ;
490490 }
491491
492- // TODO: reverse from dateFilter string to Date object
493492 function parseDate ( viewValue ) {
494493 if ( ! viewValue ) {
495494 ngModel . $setValidity ( 'date' , true ) ;
@@ -498,7 +497,7 @@ function ($compile, $parse, $document, $position, dateFilter, datepickerPopupCon
498497 ngModel . $setValidity ( 'date' , true ) ;
499498 return viewValue ;
500499 } else if ( angular . isString ( viewValue ) ) {
501- var date = new Date ( viewValue ) ;
500+ var date = dateParser . parse ( viewValue , dateFormat ) || new Date ( viewValue ) ;
502501 if ( isNaN ( date ) ) {
503502 ngModel . $setValidity ( 'date' , false ) ;
504503 return undefined ;
0 commit comments