Angular2 date pipe not working in iOS

Hi,
i’ve some data with a date string in ISO format like “YYYY-MM-DDTHH:mm:ss.sssZ”

When i use the date pipe of angular2 :

{{mesure.date | date:"dd/MM/yyyy HH:mm"}}

My App in iOS crash (but not in the browser).

Someone has the same problem ?

Thanks for your help,
regards

I would recommend rolling your own pipe using moment. The JavaScript i18n API is pretty braindead, IMHO.

Hi, thanks for your help.
Finally, i find the solution :
in my index.html, i add options to polyfills

build/polyfills.js?features=Intl.~locale.en

then, in my app.module.ts i import

import ‘intl’;
import ‘intl/locale-data/jsonp/en’;

And the date is displayed correctly without errors in iOS :slight_smile:

2 Likes

Hi,
After importing
import ‘intl’;
import ‘intl/locale-data/jsonp/en’;
in app.module.ts
is there any other changes to be made in app.module.ts ?

For anyone else having this issue.
I used angular 2 moment to solve this https://www.npmjs.com/package/angular2-moment
Older iOS versions have issues with the date or number pipe (unsupported APIs)

1 Like

This is great @cyberbobjr ! Big thanks for this solution!
Before it works on iOS 10.2 but crashes on iOS 8.1 without any errors.

installing the intl module "npm install --save intl"
and afterwards the things from @cyberbobjr helps me out of this problem

2 Likes

Not Working in ios i checked.

Not working in iOS device.