Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

time-zone

sindresorhus2.1mMIT2.0.0

Pretty time zone: +2 or -9:30

timezone, utc, time, pretty, human, date, iso, zone

readme

time-zone

Pretty time zone: +2 or -9:30

Install

$ npm install time-zone

Usage

import timeZone from 'time-zone';

// Current time zone (in Norway)
timeZone();
//=> '+2'

// Time zone in February (in Norway)
timeZone(new Date(2016, 1, 1));
//=> '+1'

// Current time zone (in French Polynesia)
timeZone();
//=> '-9:30'

API

timeZone(date?)

date

Type: Date\ Default: new Date()

Custom date.