Skip to content

Commit 3942dfe

Browse files
author
manasa
committed
Fixed then issue where the Details template displayed an incorrect dateTime value
1 parent 44a961e commit 3942dfe

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

packages/angular-sdk-components/src/lib/_components/field/date-time/date-time.component.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { FieldBase } from '../field.base';
1111
import { ComponentMapperComponent } from '../../../_bridge/component-mapper/component-mapper.component';
1212
import { getDateFormatInfo } from '../../../_helpers/date-format-utils';
1313
import { handleEvent } from '../../../_helpers/event-util';
14-
import { format } from '../../../_helpers/formatters';
1514
import { DateFormatters } from '../../../_helpers/formatters/date';
1615
import { PConnFieldProps } from '../../../_types/PConnProps.interface';
1716

@@ -81,12 +80,16 @@ export class DateTimeComponent extends FieldBase implements OnInit, OnDestroy {
8180
this.fieldControl.setValue(dateTimeValue);
8281

8382
if (['DISPLAY_ONLY', 'STACKED_LARGE_VAL'].includes(this.displayMode$)) {
84-
this.formattedValue$ = format(this.value$, 'datetime', {
85-
format: `${this.theDateFormat.dateFormatString} hh:mm A`
86-
});
83+
this.formattedValue$ = this.generateDateTime(this.value$);
8784
}
8885
}
8986

87+
generateDateTime(sVal): string {
88+
if (!sVal) return '';
89+
if (sVal.length === 10) return this.utils.generateDate(sVal, 'Date-Long-Custom-YYYY');
90+
return this.utils.generateDateTime(sVal, 'DateTime-Long-YYYY-Custom');
91+
}
92+
9093
fieldOnDateChange(event: any) {
9194
// this comes from the date pop up
9295
if (typeof event.value === 'object') {

0 commit comments

Comments
 (0)