@@ -472,7 +472,6 @@ export class IgxDatePickerComponent extends PickerBaseDirective implements Contr
472
472
private _dateValue : Date ;
473
473
private _overlayId : string ;
474
474
private _value : Date | string ;
475
- private _targetViewDate : Date ;
476
475
private _ngControl : NgControl = null ;
477
476
private _statusChanges$ : Subscription ;
478
477
private _calendar : IgxCalendarComponent ;
@@ -926,13 +925,6 @@ export class IgxDatePickerComponent extends PickerBaseDirective implements Contr
926
925
this . opened . emit ( { owner : this } ) ;
927
926
928
927
this . _calendar . wrapper ?. nativeElement ?. focus ( ) ;
929
-
930
- if ( this . _targetViewDate ) {
931
- this . _targetViewDate . setHours ( 0 , 0 , 0 , 0 ) ;
932
- // INFO: We need to set the active date to the target view date so there's something to
933
- // navigate when the calendar is opened.
934
- this . _calendar . activeDate = this . _targetViewDate ;
935
- }
936
928
} ) ;
937
929
938
930
this . _overlayService . closing . pipe ( ...this . _overlaySubFilter ) . subscribe ( ( e : OverlayCancelableEventArgs ) => {
@@ -1002,7 +994,8 @@ export class IgxDatePickerComponent extends PickerBaseDirective implements Contr
1002
994
// calendar will throw if the picker's value is InvalidDate #9208
1003
995
this . _calendar . value = this . dateValue ;
1004
996
}
1005
- this . setCalendarViewDate ( ) ;
997
+ this . _calendar . activeDate = this . activeDate ;
998
+ this . _calendar . viewDate = this . activeDate ;
1006
999
1007
1000
componentInstance . mode = this . mode ;
1008
1001
componentInstance . closeButtonLabel = this . cancelButtonLabel ;
@@ -1012,18 +1005,4 @@ export class IgxDatePickerComponent extends PickerBaseDirective implements Contr
1012
1005
componentInstance . calendarClose . pipe ( takeUntil ( this . _destroy$ ) ) . subscribe ( ( ) => this . close ( ) ) ;
1013
1006
componentInstance . todaySelection . pipe ( takeUntil ( this . _destroy$ ) ) . subscribe ( ( ) => this . selectToday ( ) ) ;
1014
1007
}
1015
-
1016
- private setCalendarViewDate ( ) {
1017
- const { minValue, maxValue } = this . getMinMaxDates ( ) ;
1018
- const dateValue = DateTimeUtil . isValidDate ( this . dateValue ) ? this . dateValue : new Date ( ) ;
1019
- if ( minValue && DateTimeUtil . lessThanMinValue ( dateValue , minValue ) ) {
1020
- this . _calendar . viewDate = this . _targetViewDate = minValue ;
1021
- return ;
1022
- }
1023
- if ( maxValue && DateTimeUtil . greaterThanMaxValue ( dateValue , maxValue ) ) {
1024
- this . _calendar . viewDate = this . _targetViewDate = maxValue ;
1025
- return ;
1026
- }
1027
- this . _calendar . viewDate = this . _targetViewDate = dateValue ;
1028
- }
1029
1008
}
0 commit comments