Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

datetimeformattimezone

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datetimeformattimezone

Surgically polyfills timezone support in Intl.DateTimeFormat API

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by400%
Maintainers
1
Weekly downloads
 
Created
Source

DateTimeFormatTimeZone

Surgically polyfills timezone support in Intl.DateTimeFormat API

![Build Status][] ![NPMRel][] [Build Status]: https://travis-ci.org/markandey/DateTimeFormatTimeZone.svg?branch=master [NPMRel]: https://img.shields.io/npm/v/datetimeformattimezone.svg

Some browsers do not support arbitrary time zone in Intl.DateTimeFormat API (becuase its optional to support timezones as per ECMA-402 standard).

This polyfill is to add this support.

new Intl.DateTimeFormat('en', {
	timeZone: 'Asia/Calcutta',
	year: 'numeric',
	month: 'numeric',
	day: 'numeric',
	hour: 'numeric',
	minute: 'numeric'
}).format(new Date());
// 12/4/2016, 3:20 AM

new Intl.DateTimeFormat('en', {
	timeZone: 'America/Los_Angeles',
	year: 'numeric',
	month: 'numeric',
	day: 'numeric',
	hour: 'numeric',
	minute: 'numeric'
}).format(new Date());
// 12/3/2016, 1:50 PM

Install

npm i datetimeformattimezone

Limitation

This pollyfill does not add support for printing timeZone name. This does not mean it breaks standard, Intl.DateTimeFormat will still behave the same as it would have without this polyfill. Also most uses cases does not include printing timeZone name.

Keywords

FAQs

Package last updated on 05 Dec 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc