Skip to content

Commit 552bd4c

Browse files
author
Sharma
committed
Fixed Time formatting issue in readonly case
1 parent 51f124f commit 552bd4c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { AngularPConnectData, AngularPConnectService } from '../../../_bridge/an
55
import { Utils } from '../../../_helpers/utils';
66
import { ComponentMapperComponent } from '../../../_bridge/component-mapper/component-mapper.component';
77
import { PConnFieldProps } from '../../../_types/PConnProps.interface';
8+
import { format } from '../../../_helpers/formatters';
89

910
interface TextProps extends PConnFieldProps {
1011
// If any, enter additional props that only exist on Text here
@@ -99,8 +100,9 @@ export class TextComponent implements OnInit, OnDestroy {
99100
break;
100101
case 'time':
101102
if (this.value$) {
102-
const timeParts = this.value$.split(':');
103-
this.formattedValue$ = `${timeParts[0]}:${timeParts[1]}`;
103+
this.formattedValue$ = format(this.value$, 'timeonly', {
104+
format: 'hh:mm A'
105+
});
104106
} else {
105107
this.formattedValue$ = '';
106108
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@
2323
</div>
2424
</ng-template>
2525
<ng-template #noEdit>
26-
<component-mapper *ngIf="bVisible$ !== false" name="Text" [props]="{ pConn$, formatAs$: 'text' }"></component-mapper>
26+
<component-mapper *ngIf="bVisible$ !== false" name="Text" [props]="{ pConn$, formatAs$: 'time' }"></component-mapper>
2727
</ng-template>

0 commit comments

Comments
 (0)