convert a string with hours to any timezone
$ npm install tizo
const tizo = require("tizo").default;
// or
import tizo from '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
Type: string
Any string containing at least a specific hour, and additionally minutes, and optionally am/pm and/or timezone
Type object
Type: array
Original, parsed time in [ hours, minutes ]
Type: array
UTC/GMT time in [ hours, minutes ]
Type: array
Local time in [ hours, minutes ]
Type: object
List of supported timezones in <timezone key>: { offset: <offset>, name: <spelled out name> }
.
See examples in the timezones.ts file.
timezone key
: abbreviated name of timezone, eg "cest"offset
: positive or negative integer or [integer, integer] representing the timezone's offsetspelled out name
: full name of the timezone, eg "Central European Summer Time"
- tizo-cli - CLI version of this module
MIT © maxrimue