Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
date-time-format-timezone
Advanced tools
Readme
Surgically polyfills timezone support in Intl.DateTimeFormat
API
Some browsers do not support arbitrary time zone in Intl.DateTimeFormat API (becuase its optional as per ECMA-402 standard). This polyfill is only to bring this support. Polyfill contains historical timezone data, CLDR data & tiny code to polyfill this support.
npm i date-time-format-timezone
And then import in your code:
require('date-time-format-timezone'); // polyfill is ready
include everything:
<script src="https://unpkg.com/date-time-format-timezone@latest/build/browserified/date-time-format-timezone-complete-min.js">
or include individual files:
<script src="https://unpkg.com/date-time-format-timezone@latest/build/browserified/date-time-format-timezone-no-data-min.js">
<script src="https://unpkg.com/date-time-format-timezone@latest/build/browserified/data/locales/locale-en-US-POSIX.js">
<script src="https://unpkg.com/date-time-format-timezone@latest/build/browserified/data/metazone.js">
<script src="https://unpkg.com/date-time-format-timezone@latest/build/browserified/data/timezones/tzdata-america-los_angeles.js">
This polyfill can add this support.
new Intl.DateTimeFormat('hi', {
timeZone: 'Asia/Calcutta',
timeZoneName:'long',
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
}).format(new Date());
"११/१/२०१७, पू १:२६ भारतीय मानक समय"
new Intl.DateTimeFormat('en', {
timeZone: 'America/Los_Angeles',
timeZoneName:'long',
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
}).format(new Date());
"1/10/2017, 12:00 PM Pacific Standard Time"
API | Support |
---|---|
Intl.DateTimeFormat | ✅ |
Date.toLocaleString | ✅ |
Date.toLocaleTimeString | ✅ |
Date.toLocaleTimeString | ✅ |
git checkout https://github.com/yahoo/date-time-format-timezone.git
npm install
grunt download
grunt
npm publish
Minified | gzipped | |
---|---|---|
complete | 2.64MB | 322KB |
top zones1 only no locale | 369.32KB | 71KB |
all zones no locale | 303.19KB | 75KB |
top zones1 top locale2 | 641.86KB | 148KB |
*1. top zones are custom listed timezones here.
*2. top locales are custom listed locales here.
FAQs
Surgically polyfills timezone support in Intl.DateTimeFormat API
The npm package date-time-format-timezone receives a total of 24,373 weekly downloads. As such, date-time-format-timezone popularity was classified as popular.
We found that date-time-format-timezone demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.