angular: date pipe formatter doesn't format minutes and seconds properly in IE 11.0.9600.18350 and Edge
I’m submitting a … (check one with “x”)
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior When using the date pipe In IE 11.0.9600.18350 with minutes/seconds it shows the whole date instead of the minutes and/or seconds.
Examples: Date recieved from service | used binding | result “2016-06-21T10:47:40Z” | {{mydate | date:‘HH’}} | 12:00 “2016-06-21T10:47:40Z” | {{mydate | date:‘mm’}} | 6/21/2016 12:47:40 PM “2016-06-21T10:47:40Z” | {{mydate | date:‘ss’}} | 6/21/2016 12:47:40 PM
“2016-06-21T10:47:40Z” | {{mydate | date:‘HH:mm’}} | 12:00:6/21/2016 12:47:40 PM “2016-06-21T10:47:40Z” | {{mydate | date:‘mm:ss’}} | 6/21/2016 12:47:40 PM:6/21/2016 12:47:40 PM “2016-06-21T10:47:40Z” | {{mydate | date:‘HH:ss’}} | 12:00:6/21/2016 12:47:40 PM
“2016-06-21T10:47:40Z” | {{mydate | date:‘HH:mm:ss’}} | 12:00:6/21/2016 12:47:40 PM:6/21/2016 12:47:40 PM
It seems that the minutes and seconds produce an entire date instead of the desired minutes/seconds.
Expected/desired behavior The expected behaviour is that mm only returns the minutes and ss only returns the seconds.
Reproduction of the problem http://plnkr.co/edit/kc8ZEMAvsx1tSbsbXTuv?p=preview
What is the expected behavior? See above.
What is the motivation / use case for changing the behavior?
Please tell us about your environment:
- Angular version: 2.0.0-rc.2 && 2.0.0-rc.3
- Browser: [ IE 11.0.9600.18350 && Edge ] this does not occur on the latest versions of Chrome and Firefox. Haven’t tested other browsers.
- Language: [TypeScript 1.8.10]
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 18
- Comments: 27 (9 by maintainers)
Commits related to this issue
- feat(core): replace intl API by our own locale files Fixes #10809, #9524, #7008, #9324, #7590, #6724, #3429, #17576, #17478, #17319, #17200, #16838, #16624, #16625, #16591, #14131, #12632, #11376, #1... — committed to ocombe/angular by ocombe 7 years ago
- feat(core): replace intl API by our own locale files Fixes #10809, #9524, #7008, #9324, #7590, #6724, #3429, #17576, #17478, #17319, #17200, #16838, #16624, #16625, #16591, #14131, #12632, #11376, #1... — committed to ocombe/angular by ocombe 7 years ago
- feat(core): replace intl API by our own locale files Fixes #10809, #9524, #7008, #9324, #7590, #6724, #3429, #17576, #17478, #17319, #17200, #16838, #16624, #16625, #16591, #14131, #12632, #11376, #1... — committed to ocombe/angular by ocombe 7 years ago
- feat(core): replace intl API by our own locale files Fixes #10809, #9524, #7008, #9324, #7590, #6724, #3429, #17576, #17478, #17319, #17200, #16838, #16624, #16625, #16591, #14131, #12632, #11376, #1... — committed to ocombe/angular by ocombe 7 years ago
- feat(core): remove dependency to intl API BREAKING CHANGE: all i18n pipes have been updated to not require the intl API anymore. Some results might vary, see the document to update from v4 to v5 for ... — committed to ocombe/angular by ocombe 7 years ago
- feat(core): remove dependency to intl API BREAKING CHANGE: all i18n pipes have been updated to not require the intl API anymore. Some results might vary, see the document to update from v4 to v5 for ... — committed to ocombe/angular by ocombe 7 years ago
- feat(core): remove dependency to intl API BREAKING CHANGE: all i18n pipes have been updated to not require the intl API anymore. Some results might vary, see the document to update from v4 to v5 for ... — committed to ocombe/angular by ocombe 7 years ago
- feat(core): remove dependency to intl API BREAKING CHANGE: all i18n pipes have been updated to not require the intl API anymore. Some results might vary, see the document to update from v4 to v5 for ... — committed to ocombe/angular by ocombe 7 years ago
- feat(core): remove dependency to intl API BREAKING CHANGE: all i18n pipes have been updated to not require the intl API anymore. Some results might vary, see the document to update from v4 to v5 for ... — committed to ocombe/angular by ocombe 7 years ago
- feat(core): remove dependency to intl API BREAKING CHANGE: all i18n pipes have been updated to not require the intl API anymore. Some results might vary, see the document to update from v4 to v5 for ... — committed to ocombe/angular by ocombe 7 years ago
- feat(core): remove dependency to intl API BREAKING CHANGE: all i18n pipes have been updated to not require the intl API anymore. Some results might vary, see the document to update from v4 to v5 for ... — committed to ocombe/angular by ocombe 7 years ago
- feat(core): remove dependency to intl API BREAKING CHANGE: all i18n pipes have been updated to not require the intl API anymore. Some results might vary, see the document to update from v4 to v5 for ... — committed to ocombe/angular by ocombe 7 years ago
- feat(core): remove dependency to intl API BREAKING CHANGE: all i18n pipes have been updated to not require the intl API anymore. Some results might vary, see the document to update from v4 to v5 for ... — committed to ocombe/angular by ocombe 7 years ago
- feat(core): remove dependency to intl API BREAKING CHANGE: all i18n pipes have been updated to not require the intl API anymore. Some results might vary, see the document to update from v4 to v5 for ... — committed to ocombe/angular by ocombe 7 years ago
- feat(core): remove dependency to intl API BREAKING CHANGE: all i18n pipes have been updated to not require the intl API anymore. Some results might vary, see the document to update from v4 to v5 for ... — committed to ocombe/angular by ocombe 7 years ago
- feat(core): remove dependency to intl API BREAKING CHANGE: all i18n pipes have been updated to not require the intl API anymore. Some results might vary, see the document to update from v4 to v5 for ... — committed to ocombe/angular by ocombe 7 years ago
- feat(core): remove dependency to intl API BREAKING CHANGE: all i18n pipes have been updated to not require the intl API anymore. Some results might vary, see the document to update from v4 to v5 for ... — committed to ocombe/angular by ocombe 7 years ago
- feat(common): drop use of the Intl API to improve browser support BREAKING CHANGE: Because of multiple bugs and browser inconsistencies, we have dropped the intl api in favor of data exported from th... — committed to ocombe/angular by ocombe 7 years ago
- feat(common): drop use of the Intl API to improve browser support BREAKING CHANGE: Because of multiple bugs and browser inconsistencies, we have dropped the intl api in favor of data exported from th... — committed to ocombe/angular by ocombe 7 years ago
- feat(common): drop use of the Intl API to improve browser support BREAKING CHANGE: Because of multiple bugs and browser inconsistencies, we have dropped the intl api in favor of data exported from th... — committed to ocombe/angular by ocombe 7 years ago
Any solution guys? If I use
date:"dd/MM/yy HH:mm:ss"
It displays the time 3 times
05/10/16 18:00:10/5/2016 6:23:14 PM:10/5/2016 6:23:14 PM
Still present in 2.4.1 release. #11054 should not be closed.
There is also another work around for this folks which uses the Date pipe as it is something we had to do in our project (it’s not perfect but it’s better than being broken)
I recommend using the ‘short’ (9/3/2010, 12:05 PM) or ‘shortDate’ (9/3/2010) or ‘shortTime’ (12:05 PM) formats (https://angular.io/docs/ts/latest/api/common/index/DatePipe-pipe.html). These do seem to work in IE and Edge, as well as other browsers. They also support locale so you’ll get a formatted date/time for that area. It’s a good workaround while this gets fixed.
Another workaround, if you have moment available, the following creates a datex pipe which uses the moment formatter instead of the angular one:
Usage:
{{exampleDate | datex:'DD/MM/YYYY HH:mm:ss'}}
This will only work correctly where exampleDate is something which can be parsed by the default moment parsing rules - see the moment documentation. It will return am empty string if something falsey is passed in.
There will be a blog post with all of the breaking changes and the best way to migrate your application to v5, so this will definitively be in it.
Am also experiencing an issue with the DatePipe in Angular 2.0.0 on IE 11:
{{exampleDate | date: 'HH:mm'}}
if formatted as10:00:10/19/2016 10:00:00 AM
.The pull request contains breaking changes. Hope it will be 5.0 then, not 6.0!