@@ -8,7 +8,7 @@ import { By } from '@angular/platform-browser';
88import { ControlsFunction } from '../../../test-utils/controls-functions.spec' ;
99import { UIInteractions } from '../../../test-utils/ui-interactions.spec' ;
1010import { HelperTestFunctions } from '../../../test-utils/calendar-helper-utils' ;
11- import { CancelableEventArgs , I18N_FORMATTER , WEEKDAYS } from 'igniteui-angular/core' ;
11+ import { CancelableEventArgs , WEEKDAYS } from 'igniteui-angular/core' ;
1212import { IgxDateRangeSeparatorDirective , IgxDateRangeStartComponent } from './date-range-picker-inputs.common' ;
1313import { IgxDateTimeEditorDirective } from '../../../directives/src/directives/date-time-editor/date-time-editor.directive' ;
1414import { DateRangeType } from 'igniteui-angular/core' ;
@@ -22,7 +22,7 @@ import { IgxIconComponent } from 'igniteui-angular/icon';
2222import { registerLocaleData } from "@angular/common" ;
2323import localeJa from "@angular/common/locales/ja" ;
2424import localeBg from "@angular/common/locales/bg" ;
25- import { CalendarDay , BaseFormatter } from 'igniteui-angular/core' ;
25+ import { CalendarDay } from 'igniteui-angular/core' ;
2626import { IgxCalendarComponent , IgxCalendarHeaderTemplateDirective , IgxCalendarHeaderTitleTemplateDirective , IgxCalendarSubheaderTemplateDirective } from 'igniteui-angular/calendar' ;
2727import { KeyboardNavigationService } from 'igniteui-angular/calendar/src/calendar/calendar.services' ;
2828
@@ -50,6 +50,7 @@ const CSS_CLASS_CALENDAR_HEADER_TITLE = '.igx-calendar__header-year';
5050const CSS_CLASS_CALENDAR_SUBHEADER = '.igx-calendar-picker__dates' ;
5151const CSS_CLASS_CALENDAR_HEADER = '.igx-calendar__header' ;
5252const CSS_CLASS_CALENDAR_WRAPPER_VERTICAL = 'igx-calendar__wrapper--vertical' ;
53+
5354describe ( 'IgxDateRangePicker' , ( ) => {
5455 describe ( 'Unit tests: ' , ( ) => {
5556 let mockElement : any ;
@@ -1067,6 +1068,29 @@ describe('IgxDateRangePicker', () => {
10671068 fixture . detectChanges ( ) ;
10681069 verifyDateRange ( ) ;
10691070 } ) ;
1071+
1072+ it ( 'should not mutate the time of the passed-in value when opening the picker' , fakeAsync ( ( ) => {
1073+ const start = new Date ( 2026 , 4 , 10 , 14 , 30 , 45 ) ;
1074+ const end = new Date ( 2026 , 4 , 20 , 15 , 15 , 30 ) ;
1075+ dateRange . value = { start, end } ;
1076+ fixture . detectChanges ( ) ;
1077+
1078+ dateRange . open ( ) ;
1079+ tick ( ) ;
1080+ fixture . detectChanges ( ) ;
1081+
1082+ expect ( start . getHours ( ) ) . toBe ( 14 ) ;
1083+ expect ( start . getMinutes ( ) ) . toBe ( 30 ) ;
1084+ expect ( start . getSeconds ( ) ) . toBe ( 45 ) ;
1085+ expect ( end . getHours ( ) ) . toBe ( 15 ) ;
1086+ expect ( end . getMinutes ( ) ) . toBe ( 15 ) ;
1087+ expect ( end . getSeconds ( ) ) . toBe ( 30 ) ;
1088+
1089+ dateRange . close ( ) ;
1090+ tick ( ) ;
1091+ fixture . detectChanges ( ) ;
1092+ } ) ) ;
1093+
10701094 it ( 'should support different input and display formats' , ( ) => {
10711095 let inputFormat = 'dd/MM/yy' ;
10721096 let displayFormat = 'longDate' ;
0 commit comments