@@ -418,6 +418,19 @@ describe('DetailsFieldsComponent', () => {
418418 expect ( component . saveEntry . emit ) . toHaveBeenCalledWith ( data ) ;
419419 } ) ;
420420
421+ it ( 'should not modify the start_date when start_hour has not been modified' , ( ) => {
422+ const currentDate = moment ( ) . format ( 'YYYY-MM-DD' ) ;
423+ const startHour = moment ( ) . subtract ( 3 , 'hours' ) . format ( 'HH:mm:ss' ) ;
424+ const expectedStartDate = new Date ( `${ currentDate } T${ startHour . trim ( ) } ` ) ;
425+
426+ component . entryToEdit = { ...entryToEdit , start_date : expectedStartDate } ;
427+ fixture . componentInstance . ngOnChanges ( ) ;
428+
429+ component . entryForm . patchValue ( { description : 'test' } ) ;
430+
431+ expect ( component . dateToSubmit ( 'start_date' , 'start_hour' ) ) . toEqual ( expectedStartDate ) ;
432+ } ) ;
433+
421434 it ( 'should modify the start_date when start_hour has been modified' , ( ) => {
422435 const startDate = new Date ( mockCurrentDate ) ;
423436
@@ -432,6 +445,19 @@ describe('DetailsFieldsComponent', () => {
432445 expect ( component . dateToSubmit ( 'start_date' , 'start_hour' ) ) . toEqual ( expectedStartDate ) ;
433446 } ) ;
434447
448+ it ( 'should not modify the end_date when end_hour has not been modified' , ( ) => {
449+ const currentDate = moment ( ) . format ( 'YYYY-MM-DD' ) ;
450+ const endHour = moment ( ) . subtract ( 3 , 'hours' ) . format ( 'HH:mm:ss' ) ;
451+ const expectedEndDate = new Date ( `${ currentDate } T${ endHour . trim ( ) } ` ) ;
452+
453+ component . entryToEdit = { ...entryToEdit , end_date : expectedEndDate } ;
454+ fixture . componentInstance . ngOnChanges ( ) ;
455+
456+ component . entryForm . patchValue ( { description : 'test' } ) ;
457+
458+ expect ( component . dateToSubmit ( 'end_date' , 'end_hour' ) ) . toEqual ( expectedEndDate ) ;
459+ } ) ;
460+
435461 it ( 'should modify the end_date when end_hour has been modified' , ( ) => {
436462 const endDate = new Date ( mockCurrentDate ) ;
437463
0 commit comments