ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

Date pipe crashing in prod mode build.

Open ezekjh opened this issue 10 years ago • 4 comments

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

  1. 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>
  2. Do ionic run browser (prod mode).
  3. 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 

ezekjh avatar Oct 24 '16 14:10 ezekjh

I gave up using date pipe in RC0/RC1.

An workaround is using moment library.

cleever avatar Oct 24 '16 15:10 cleever

@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.

ezekjh avatar Oct 24 '16 15:10 ezekjh

Hello, thanks for using Ionic! We are tracking this issue here.

jgw96 avatar Oct 24 '16 16:10 jgw96

the same problem!

xggaxlc avatar Oct 27 '16 02:10 xggaxlc