I have changes.lastUpdatedTime.currentValue
which is 1540460704884
I want to use pipe for date format
e.g. {{lastUpdatedTime | date:'short'}}
How I can use | pipe inside the component.
${changes.lastUpdatedTime.currentValue} | date:'short'
something like this I want to use.
Code Below -
ngOnChanges(changes: SimpleChanges): void {
if (changes.typeLabel && changes.cardLabel && changes.severity) {
this.title = `[${this.severityName}] ${changes.cardLabel.currentValue}
Type: ${changes.typeLabel.currentValue}
Status changed: ${changes.lastUpdatedTime.currentValue}`;
}
}
I tried to use as below code but it's not working.
${changes.lastUpdatedTime.currentValue.transform(myDate, 'yyyy-MM-dd')};
I tried to use this - But it's not working.
ngOnChanges(changes: SimpleChanges): void {
if (changes.typeLabel && changes.cardLabel && changes.severity) {
let displayedLastUpdatedTime = new DatePipe().transform(changes.lastUpdatedTime.currentValue);
this.title = `[${this.severityName}] ${changes.cardLabel.currentValue}
Type: ${changes.typeLabel.currentValue}
Status changed: ${displayedLastUpdatedTime}`;
}
}
this gives error "has no exported member 'DatePipe'"
Thanks