Skip to content

Instantly share code, notes, and snippets.

@deebloo
Created May 13, 2016 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deebloo/5f6e848c559f3e8223507abece6ed691 to your computer and use it in GitHub Desktop.
Save deebloo/5f6e848c559f3e8223507abece6ed691 to your computer and use it in GitHub Desktop.
Easily create a better Angular2 data pipe with Momentjs
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