see also https://github.com/angular/angular/issues/6336

On Thursday, January 21, 2016 at 1:51:59 PM UTC+1, levyuk wrote:
>
> It looks like it is the format of the date which is causing the problem. 
> If I do
>
> new Date(myDate)|date 
>
> then it works fine. 
>
> Thanks
> Jon
>
> On Thursday, 21 January 2016 12:48:02 UTC, Günter Zöchbauer wrote:
>>
>> You get this error if the value doesn't pass this check
>>
>>
>> https://github.com/angular/angular/blob/5ba9ced1ab6540d9ad2e25f158355633a65adc4f/modules/angular2/src/common/pipes/date_pipe.ts#L121
>>
>> supports(obj: any): boolean { return isDate(obj) || isNumber(obj); }
>>
>> isDate from 
>> https://github.com/angular/angular/blob/7ae23adaff2990cf6022af9792c449730d451d1d/modules/angular2/src/facade/lang.ts#L126
>>
>> export function isDate(obj): boolean { return obj instanceof Date && 
>> !isNaN(obj.valueOf());}
>>
>> so, the value has to be either of type `Date` or `number`
>>
>> This might work (not tried)
>>
>> {{new Date(app.LastUpdated)|date}}
>>
>> On Thursday, January 21, 2016 at 11:13:13 AM UTC+1, levyuk wrote:
>>>
>>> Anyone know why when I try to format a date with the date pipe I get the 
>>> following error?
>>>
>>> Invalid argument '2016-01-19T10:10:49.892688Z' for pipe 'DatePipe' in [ 
>>> {{app.LastUpdated|date}}
>>>
>>
>>  
>>
>>>
>>> Thanks
>>> Jon
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to