{"id":13634925,"url":"https://github.com/formatjs/date-time-format-timezone","last_synced_at":"2025-04-19T03:34:01.522Z","repository":{"id":60775039,"uuid":"78865197","full_name":"formatjs/date-time-format-timezone","owner":"formatjs","description":"Surgically polyfills timezone support in Intl.DateTimeFormat API","archived":true,"fork":false,"pushed_at":"2020-02-26T23:20:09.000Z","size":2323,"stargazers_count":108,"open_issues_count":11,"forks_count":20,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-14T14:21:34.524Z","etag":null,"topics":["cldr","datetimeformat","ecma-402","iana","icu","intl","polyfill"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/formatjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-13T16:29:07.000Z","updated_at":"2024-09-10T12:32:56.000Z","dependencies_parsed_at":"2022-10-04T16:32:15.446Z","dependency_job_id":null,"html_url":"https://github.com/formatjs/date-time-format-timezone","commit_stats":null,"previous_names":["yahoo/date-time-format-timezone"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formatjs%2Fdate-time-format-timezone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formatjs%2Fdate-time-format-timezone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formatjs%2Fdate-time-format-timezone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formatjs%2Fdate-time-format-timezone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/formatjs","download_url":"https://codeload.github.com/formatjs/date-time-format-timezone/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249600500,"owners_count":21297705,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cldr","datetimeformat","ecma-402","iana","icu","intl","polyfill"],"created_at":"2024-08-02T00:00:37.763Z","updated_at":"2025-04-19T03:34:01.506Z","avatar_url":"https://github.com/formatjs.png","language":"JavaScript","readme":"# Intl.DateTimeFormat timezone polyfill\nSurgically polyfills timezone support in `Intl.DateTimeFormat` API\n\n[![Build Status](https://travis-ci.org/formatjs/date-time-format-timezone.svg?branch=master)](https://travis-ci.org/formatjs/date-time-format-timezone) [![NPMRel](https://img.shields.io/npm/v/date-time-format-timezone.svg)](https://www.npmjs.com/package/date-time-format-timezone)  \n\nSome [browsers do not support arbitrary time zone ](http://kangax.github.io/compat-table/esintl/) in Intl.DateTimeFormat API (becuase its optional as per [ECMA-402 standard](https://www.ecma-international.org/ecma-402/1.0/#sec-6.4)). This polyfill is only to bring this support. Polyfill contains historical timezone data, CLDR data \u0026 tiny code to polyfill this support.\n\n## How to use?\n\n1. Install via nodejs:\n```\nnpm i date-time-format-timezone\n```\nAnd then import in your code:\n```\nrequire('date-time-format-timezone'); // polyfill is ready\n```\n\n2. In the browser\n\ninclude everything:\n```\n\u003cscript src=\"https://unpkg.com/date-time-format-timezone@latest/build/browserified/date-time-format-timezone-complete-min.js\"\u003e\n```\nor include individual files:\n\n```\n\u003cscript src=\"https://unpkg.com/date-time-format-timezone@latest/build/browserified/date-time-format-timezone-no-data-min.js\"\u003e\n\u003cscript src=\"https://unpkg.com/date-time-format-timezone@latest/build/browserified/data/locales/locale-en-US-POSIX.js\"\u003e\n\u003cscript src=\"https://unpkg.com/date-time-format-timezone@latest/build/browserified/data/metazone.js\"\u003e\n\u003cscript src=\"https://unpkg.com/date-time-format-timezone@latest/build/browserified/data/timezones/tzdata-america-los_angeles.js\"\u003e\n ```\nThis polyfill can add this support.\n\n```javascript\nnew Intl.DateTimeFormat('hi', {\n    timeZone: 'Asia/Calcutta',\n    timeZoneName:'long',\n    year: 'numeric',\n    month: 'numeric',\n    day: 'numeric',\n    hour: 'numeric',\n    minute: 'numeric',\n}).format(new Date());\n\n\"११/१/२०१७, पू १:२६ भारतीय मानक समय\"\n\n\nnew Intl.DateTimeFormat('en', {\n    timeZone: 'America/Los_Angeles',\n    timeZoneName:'long',\n    year: 'numeric',\n    month: 'numeric',\n    day: 'numeric',\n    hour: 'numeric',\n    minute: 'numeric',\n}).format(new Date());\n\n\"1/10/2017, 12:00 PM Pacific Standard Time\"\n```\n\n## Support\n|     API                           |Support|\n|---------------------------------  |------ |\n| Intl.DateTimeFormat               | ✅   |\n| Date.toLocaleString               | ✅   |\n| Date.toLocaleTimeString           | ✅   |\n| Date.toLocaleTimeString           | ✅   |\n\n\n## Generate latest data from [www.iana.org](http://www.iana.org/time-zones).\n```\ngit checkout https://github.com/yahoo/date-time-format-timezone.git\nnpm install\ngrunt download\ngrunt\nnpm publish\n```\n\n## Browserified file size\n\n|                            | Minified | gzipped |\n|----------------------------|----------|---------|\n| complete                   | 2.64MB   | 322KB   |\n| top zones\u003csup\u003e1\u003c/sup\u003e only no locale   | 369.32KB | 71KB    |\n| all zones no locale        | 303.19KB | 75KB    |\n| top zones\u003csup\u003e1\u003c/sup\u003e top locale\u003csup\u003e2\u003c/sup\u003e       | 641.86KB | 148KB   |\n\n  *1. top zones are custom listed timezones [here](https://github.com/yahoo/date-time-format-timezone/blob/master/tasks/gen-package.js#L51).\n  \n  *2. top locales are custom listed locales [here](https://github.com/yahoo/date-time-format-timezone/blob/master/tasks/gen-package.js#L13).\n\n\n## References\n   1. http://www.unicode.org/reports/tr35/tr35-dates.html#Using_Time_Zone_Names\n   1. http://icu-project.org/apiref/icu4j/com/ibm/icu/text/TimeZoneNames.html\n","funding_links":[],"categories":["i18n (国际化)"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fformatjs%2Fdate-time-format-timezone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fformatjs%2Fdate-time-format-timezone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fformatjs%2Fdate-time-format-timezone/lists"}