Date pipe crashing in prod mode build.
Short description of the problem:
When using a date pipe with a format string I get
TypeError: Cannot convert undefined or null to object at new DateTimeFormat (native).
on the console and app breaks. This only happens on a prod build. Doing a dev build does not produce this error and the date gets formatted correctly.
It seems that the locale parameter is null when calling Intl.DateTimeFormat().
What behavior are you expecting?
Dates should be correctly formatted using a date pipe on prod build.
Steps to reproduce
- Add any element and render a date property with the date pipe and any format string.
Something like
<span>{{inspection.updatedOn | date: "MM/dd/yy HH:mm:ss Z"}}</span> - Do ionic run browser (prod mode).
- Check browser console, the above mentioned error shows and the app is broken.
Browser: Chrome and Opera.
Cordova CLI: 6.3.1
Gulp version: CLI version 3.9.1
Gulp local:
Ionic Framework Version: 2.0.0-rc.1
Ionic CLI Version: 2.1.1
Ionic App Lib Version: 2.1.1
Ionic App Scripts Version: 0.0.36
OS: Windows 8.1
Node Version: v6.3.1
I gave up using date pipe in RC0/RC1.
An workaround is using moment library.
@cleever well, it was working fine. And the issue is only on prod build. So I'm not sure wether it's an Angular issue, or there's something else going on in the build process.
Hello, thanks for using Ionic! We are tracking this issue here.
the same problem!