Created
January 3, 2016 23:08
-
-
Save brandonhuff/fdc1aa9e0ca6297555a0 to your computer and use it in GitHub Desktop.
Angular 2 Beta.0 pipe for converting ISO 8601 string dates to javascript Date type.
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
// https://en.wikipedia.org/wiki/ISO_8601 | |
// Example | |
// Usage: {{ dateValue | unicodeToDate | date:'MM/dd/yyyy' }} | |
// Data: 2014-01-05T18:14:18.32 | |
// Result: 01/05/2014 | |
import {Pipe} from 'angular2/core'; | |
@Pipe({name: 'unicodeToDate'}) | |
export class UnicodeToDatePipe { | |
transform(value:string, args:string[]) : any { | |
return new Date(value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thx