Created
May 13, 2016 17:55
-
-
Save deebloo/5f6e848c559f3e8223507abece6ed691 to your computer and use it in GitHub Desktop.
Easily create a better Angular2 data pipe with Momentjs
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 {Pipe, PipeTransform} from '@angular/core'; | |
import * as moment from 'moment'; | |
@Pipe({ | |
name: 'moment' | |
}) | |
export class MomentPipe implements PipeTransform { | |
transform(date, format) { | |
return moment(date).format(format); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment