This repository was archived by the owner on May 29, 2019. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,13 +47,13 @@ angular.module('ui.bootstrap.datepicker', [])
4747
4848 if ( attrs . min ) {
4949 scope . $parent . $watch ( $parse ( attrs . min ) , function ( value ) {
50- minDate = new Date ( value ) ;
50+ minDate = value ? new Date ( value ) : null ;
5151 refill ( ) ;
5252 } ) ;
5353 }
5454 if ( attrs . max ) {
5555 scope . $parent . $watch ( $parse ( attrs . max ) , function ( value ) {
56- maxDate = new Date ( value ) ;
56+ maxDate = value ? new Date ( value ) : null ;
5757 refill ( ) ;
5858 } ) ;
5959 }
@@ -161,7 +161,7 @@ angular.module('ui.bootstrap.datepicker', [])
161161
162162 scope . $watch ( 'model' , function ( dt , olddt ) {
163163 if ( angular . isDate ( dt ) ) {
164- selected = angular . copy ( dt ) ;
164+ selected = new Date ( dt ) ;
165165 }
166166
167167 if ( ! angular . equals ( dt , olddt ) ) {
Original file line number Diff line number Diff line change @@ -507,6 +507,20 @@ describe('datepicker directive', function () {
507507 }
508508 }
509509 } ) ;
510+
511+ it ( 'enables everything before if it is cleared' , function ( ) {
512+ $rootScope . mindate = null ;
513+ $rootScope . date = new Date ( "December 20, 1949" ) ;
514+ $rootScope . $digest ( ) ;
515+
516+ clickTitleButton ( ) ;
517+ for ( var i = 0 ; i < 4 ; i ++ ) {
518+ for ( var j = 0 ; j < 3 ; j ++ ) {
519+ expect ( getOptionsEl ( i , j ) . find ( 'button' ) . prop ( 'disabled' ) ) . toBe ( false ) ;
520+ }
521+ }
522+ } ) ;
523+
510524 } ) ;
511525
512526 describe ( 'max attribute' , function ( ) {
@@ -580,6 +594,16 @@ describe('datepicker directive', function () {
580594 }
581595 }
582596 } ) ;
597+
598+ it ( 'enables everything after if it is cleared' , function ( ) {
599+ $rootScope . maxdate = null ;
600+ $rootScope . $digest ( ) ;
601+ for ( var i = 0 ; i < 5 ; i ++ ) {
602+ for ( var j = 0 ; j < 7 ; j ++ ) {
603+ expect ( getOptionsEl ( i , j ) . find ( 'button' ) . prop ( 'disabled' ) ) . toBe ( false ) ;
604+ }
605+ }
606+ } ) ;
583607 } ) ;
584608
585609 describe ( 'date-disabled expression' , function ( ) {
You can’t perform that action at this time.
0 commit comments