I've implemented a date pipe using the date-fns library for formatting dates. Here is the code:
date.pipe.ts
import { Pipe, PipeTransform } from '@angular/core';
import { format } from 'date-fns';
@Pipe({
name: 'formatDate'
})
export class FormatDatePipe implements PipeTransform {
transform(value: string | number | Date, dateFormat: string): string {
return format(value, dateFormat);
}
}
component.html
<h1> {{ startDate | formatDate: 'DD-MM-YYYY HH:mm:ss.SSSZ' }} </h1>
The current output displays the time zone as -05:00. However, I would like to show the exact time zone (UTC-5) instead. Expected output
01-01-2021 07:09:00.000 (UTC-5)