This repository was archived by the owner on May 29, 2019. It is now read-only.
File tree 2 files changed +27
-3
lines changed
2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -47,13 +47,13 @@ angular.module('ui.bootstrap.datepicker', [])
47
47
48
48
if ( attrs . min ) {
49
49
scope . $parent . $watch ( $parse ( attrs . min ) , function ( value ) {
50
- minDate = new Date ( value ) ;
50
+ minDate = value ? new Date ( value ) : null ;
51
51
refill ( ) ;
52
52
} ) ;
53
53
}
54
54
if ( attrs . max ) {
55
55
scope . $parent . $watch ( $parse ( attrs . max ) , function ( value ) {
56
- maxDate = new Date ( value ) ;
56
+ maxDate = value ? new Date ( value ) : null ;
57
57
refill ( ) ;
58
58
} ) ;
59
59
}
@@ -161,7 +161,7 @@ angular.module('ui.bootstrap.datepicker', [])
161
161
162
162
scope . $watch ( 'model' , function ( dt , olddt ) {
163
163
if ( angular . isDate ( dt ) ) {
164
- selected = angular . copy ( dt ) ;
164
+ selected = new Date ( dt ) ;
165
165
}
166
166
167
167
if ( ! angular . equals ( dt , olddt ) ) {
Original file line number Diff line number Diff line change @@ -507,6 +507,20 @@ describe('datepicker directive', function () {
507
507
}
508
508
}
509
509
} ) ;
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
+
510
524
} ) ;
511
525
512
526
describe ( 'max attribute' , function ( ) {
@@ -580,6 +594,16 @@ describe('datepicker directive', function () {
580
594
}
581
595
}
582
596
} ) ;
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
+ } ) ;
583
607
} ) ;
584
608
585
609
describe ( 'date-disabled expression' , function ( ) {
You can’t perform that action at this time.
0 commit comments