Created
February 22, 2017 09:28
-
-
Save goranprijic/e25a7f0c16075d7ab759d65e4afd794a to your computer and use it in GitHub Desktop.
Using local timezone in angular2 date pipe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { PipeTransform } from '@angular/core'; | |
import { DatePipe } from '@angular/common'; | |
import { CONFIG_LOCAL_TIMEZONE_SHIFT } from './../../environment'; | |
export class LocalDatePipe extends DatePipe implements PipeTransform { | |
transform(value: any, pattern: string = 'mediumDate'): string { | |
return super.transform(value + CONFIG_LOCAL_TIMEZONE_SHIFT, pattern); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hy ! May i ask you how to use this Date Pipe ?
What are the CONFIG_LOCAL_TIMEZONE_SHIFT value ?