Skip to content

Instantly share code, notes, and snippets.

@brandonhuff
Created January 3, 2016 23:08

Revisions

  1. brandonhuff created this gist Jan 3, 2016.
    14 changes: 14 additions & 0 deletions unicodetodate.pipe.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    // 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);
    }
    }