tizo
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

tizo Build Status Greenkeeper badge

convert a string with hours to any timezone

Install

$ npm install tizo

Usage

const tizo = require("tizo");
 
tizo("19:30 CEST").utc;
// → '[ 17, 30 ]'
 
tizo("9pm").original;
// → '[ 21, 0 ]'
 
tizo("08:21").local;
// → '[ 8 + local offset, 21 + local offset ]'
  • supports many different, popular timezones, including summer/winter adaptions
  • automatically parses 'am' and 'pm' for time formatting
  • doesn't require internet connection for any lookup
  • flexible formatting (eg sss01:02 aM CesT sss[1, 2, 'am', 'cest'])
  • returns local, utc (gmt) and parsed time

API

tizo(input)

input

Type: string

Any string containing at least a specific hour, and additionally minutes, and/or am/pm and/or timezone

returns

Type object

original

Type: array

Original, parsed time in [ hours, minutes ]

utc

Type: array

UTC/GMT time in [ hours, minutes ]

local

Type: array

Local time in [ hours, minutes ]

timezones

Type: object

List of supported timezones in <timezone>: <offset> (Note: <offset> can either be a string or an array, depending on whether the offset is a fixed amount of hours or also includes minutes, like ACDT (+9:30))

Related

License

MIT © maxrimue

Dependents (1)

Package Sidebar

Install

npm i tizo

Weekly Downloads

2

Version

3.0.0

License

MIT

Unpacked Size

10.9 kB

Total Files

7

Last publish

Collaborators

  • maxrimue