Ability to provide IANA time zone for date formatting
See original GitHub issueπ feature request
Description
Ability to provide IANA time zone for date formatting.
Describe the solution youβd like
before:
const date = new Date();
const format = 'short';
const locale = 'tr';
const timezone = '+3'; // offset from GMT
formatDate(date, format, locale, timezone);
after:
const date = new Date();
const format = 'short';
const locale = 'tr';
const timezone = 'Europe/Istanbul'; // IANA time zone
formatDate(date, format, locale, timezone);
For now itβs possible to provide time zone offset from GMT (such as '+0430'
), but would be great to have an option to provide IANA time zone with Intl.DateTimeFormat
instance.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
How to format a date-time to display the timezone in IANA ...
Format method. You could use a third-party lib though, e.g. go-timezone-local, to get the IANA name of your time zone and prepend it...
Read more >Time Zone Database
The Time Zone Database (often called tz or zoneinfo) contains code and data that represent the history of local time for many representative...
Read more >RFC 6557: Procedures for Maintaining the Time Zone Database
The Time Zone (TZ) Database specifies the indices used in various protocols ... to the extent possible, to document existing practice and provide...
Read more >Handling Time Zone in JavaScript - TOAST UI - Medium
This time system is based on International Atomic Time, which uses the cesium atomic frequency to set the time standard. In other words,...
Read more >Time Zone Database Parser - Howard Hinnant
The entire time_get / time_put formatting capability is also at your ... The date::locate_zone() function looks up the IANA time zone with the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Nice! I see that it is possible (if a little ugly) in modern browsers. But unfortunately, IE11 which we still must support does not support IANA timezone names: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString#browser_compatibility
So we would still have to polyfill that. I think someone publishing a small library would be a good way to go to provide this.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.