novo-elements
Version:
Bullhorn's NOVO Element Repository for Angular 2
10 lines (8 loc) • 424 B
text/typescript
import { Pipe, PipeTransform, LOCALE_ID, Inject } from '@angular/core';
({ name: 'monthday' })
export class MonthDayPipe implements PipeTransform {
constructor( (LOCALE_ID) private locale: string = 'en-US') { }
transform(date: Date, locale: string = this.locale, method: string = 'short'): string {
return new Intl.DateTimeFormat(locale, { month: method, day: 'numeric' }).format(date);
}
}