javascript date pipe central timezone example
Example 1: javascript date pipe central timezone example
import { Pipe, PipeTransform } from '@angular/core';import { DatePipe } from '@angular/common';import * as moment from 'moment-timezone';@Pipe({ name: 'momentDate'})export class MomentDatePipe extends DatePipe implements PipeTransform {transform( value: string | Date, format: string = 'mediumDate', timezone: string = 'Europe/Prague'): string { const timezoneOffset = moment(value).tz(timezone).format('Z'); return super.transform(value, format, timezoneOffset); }}
Example 2: javascript date pipe central timezone example
<!--output '2015-06-15 05:03 PM GMT+9'-->
<p>The custom date is {{today | date:'yyyy-MM-dd HH:mm a z':'+0900'}</p>