-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support IANA time zone for date formatting #48279
Comments
Angular has dropped the intl API in v5 (2017) because of some bugs. Now it's almost 2023, IE support is not needed, intl polyfill is probably not needed? Wouldn't it be possible to switch back to the intl API as it's more stable now? |
We should be able to remove those IE / Edge workarounds and would welcome community contributions to fix this issue. |
@jessicajaniuk may I help to fixed this issue? |
Please do, @surajy93. We'd appreciate it. |
In context to year 2023 and Angular 15+, if passing IANA value doesn't work, what is the |
|
...or
but I'm not sure what continental US time zone abbreviation means, exactly. In particular, I'd appreciate the timezones to automatically consider summer time (as Intl does, AFAIK): Europe/Rome is CEST (UTC+2) during the summer and CET (UTC+1) during the winter.
|
This is what this issue and the submitted PR is about. But the PR have been hanging for almost a year without any closure, so I no longer expect it to be merged. :) |
I agree,,, |
Can anybody provide some details what is the state of this issue? And what exactly wrong with related PR? |
It doesn't appear like this issue was prioritized and potentially won't be merged as described by the author. Also, with the advent of Angular 17's release last November 2023, if IANA time zone support wasn't added inside of the out-of-box date pipes they support, then this is still a valid issue to keep open. I guess before assuming DatePipe isn't usable at all, it really depends if the IANA time zone support use-case is truly needed. Is it make/break for your project? I wanted to use it because of the flexibility it has for areas of the US that didn't observe DST (e.g., Arizona, Hawaii), but found compromise (with Product Team) in the feature needed (we're simply using Standard Time offsets such as I realize my case doesn't match up with yours, and I'm in all likely cases comparing apples to oranges, but I guess what I'm trying to land on is, can you use existing alternatives as a compromise for what you're trying to build out? |
We're currently investigation relying on the Feel free to subscribe to #54470 for any updates on that topic. |
With the Intl implementation is enabled, it is not necessary anymore to import the locale date files. This implementation adds the support for IANA timezones. Fixes angular#48279 The new Intl implementation introduce some limitations. Some custom date format aren't supported any more (`cccccc`, `EEEEEE`, `aaaaa`, `b` to `bbbbb` and `B` to `BBBBB`)
Which @angular/* package(s) are relevant/related to the feature request?
No response
Description
This was once requested #40865 but is now locked due to inactivity. I want to raise this again because IMO supporting
IANA
timezone names natively is a huge improvement, especially now when you can set the default timezone (which is actually an UTC offset, not a timezone) throughDATE_PIPE_DEFAULT_OPTIONS
token.Why supporting
IANA
is such a big deal? Because of Daylight Saving Time (DST).Countries that are using DST does not have a fixed UTC offset, it depends on the season.
So setting a default timezone (which is an UTC offset) through
DATE_PIPE_DEFAULT_OPTIONS
does not bring that much value today, it's even hard to think of a use case for this. For applications that let the user to set their preferred timezone in settings this token can't be utilized, you're still forced to come up with workaroundish solutions like creating a custom date pipe.This is a default behaviour when timezone is not provided:
Now imagine we want to format all dates the same for all the users not matter on what timezone they are (maybe it's a company timezone, whatever). What
DATE_PIPE_DEFAULT_OPTIONS
value has to be provided for this to work?UTC+2
orUTC+3
(in case ofEurope/Vilnius
tz)? You see, you can't choose one, both are needed depending on the date you're trying to format.Proposed solution
Add support for
IANA
time zone name in all these APIs:https://angular.io/api/common/DATE_PIPE_DEFAULT_OPTIONS
https://angular.io/api/common/formatDate
https://angular.io/api/common/DatePipe
Alternatives considered
If for some reason
IANA
time zone support is not considered to be implemented now or in the future then I would suggest renaming thetimezone
property toutcOffset
which would be more accurate and less confusing for developers.The text was updated successfully, but these errors were encountered: