question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
petebacondarwincommented, Feb 16, 2021

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.

0reactions
angular-automatic-lock-bot[bot]commented, Mar 19, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found