@@ -7,15 +7,13 @@ import { MatFormFieldModule } from '@angular/material/form-field';
77import { OwlDateTimeModule , OwlNativeDateTimeModule } from '@danielmoncada/angular-datetime-picker' ;
88import { interval } from 'rxjs' ;
99import dayjs from 'dayjs' ;
10- import moment from 'moment' ;
1110import { AngularPConnectData , AngularPConnectService } from '../../../_bridge/angular-pconnect' ;
1211import { Utils } from '../../../_helpers/utils' ;
1312import { ComponentMapperComponent } from '../../../_bridge/component-mapper/component-mapper.component' ;
1413import { dateFormatInfoDefault , getDateFormatInfo } from '../../../_helpers/date-format-utils' ;
1514import { PConnFieldProps } from '../../../_types/PConnProps.interface' ;
1615import { handleEvent } from '../../../_helpers/event-util' ;
1716import { format } from '../../../_helpers/formatters' ;
18- import DateFormatter from '../../../_helpers/formatters/date' ;
1917
2018interface DateTimeProps extends PConnFieldProps {
2119 // If any, enter additional props that only exist on DateTime here
@@ -94,7 +92,7 @@ export class DateTimeComponent implements OnInit, OnDestroy {
9492 this . formGroup$ . addControl ( this . controlName$ , this . fieldControl ) ;
9593 let dateTimeValue = this . value$ ?? '' ;
9694 if ( this . value$ ) {
97- dateTimeValue = dayjs ( DateFormatter ?. convertToTimezone ( this . value$ , { timezone : this . timezone } ) ) ?. toISOString ( ) ;
95+ dateTimeValue = dayjs ( format ( this . value$ , 'convertToTimezone' , { timezone : this . timezone } ) ) ?. toISOString ( ) ;
9896 }
9997 this . fieldControl . setValue ( dateTimeValue ) ;
10098 this . bHasForm$ = true ;
@@ -142,7 +140,7 @@ export class DateTimeComponent implements OnInit, OnDestroy {
142140 this . value$ = this . configProps$ ?. value ;
143141 let dateTimeValue = this . configProps$ ?. value ?? '' ;
144142 if ( this . value$ ) {
145- dateTimeValue = dayjs ( DateFormatter ?. convertToTimezone ( this . value$ , { timezone : this . timezone } ) ) ?. toISOString ( ) ;
143+ dateTimeValue = dayjs ( format ( this . value$ , 'convertToTimezone' , { timezone : this . timezone } ) ) ?. toISOString ( ) ;
146144 }
147145 this . fieldControl . setValue ( dateTimeValue ) ;
148146 // timeout and detectChanges to avoid ExpressionChangedAfterItHasBeenCheckedError
@@ -198,7 +196,7 @@ export class DateTimeComponent implements OnInit, OnDestroy {
198196 // this comes from the date pop up
199197 if ( typeof event . value === 'object' ) {
200198 // convert date to pega "date" format
201- const dateTime = moment ( event . value ?. toISOString ( ) ) ;
199+ const dateTime = dayjs ( event . value ?. toISOString ( ) ) ;
202200 const timeZoneDateTime = dayjs . tz ( dateTime . format ( 'YYYY-MM-DDTHH:mm:ss' ) , this . timezone ) ;
203201 event . value = timeZoneDateTime && timeZoneDateTime . isValid ( ) ? timeZoneDateTime . toISOString ( ) : '' ;
204202 }
0 commit comments