timezone-names
A simple library to get timezone offsets. Functions accept timezone names. Abbreviations are not supported because same abbreviation is used for multiple timezones.
Functions
getTimezoneByName
Get timezone info object.
var tz = require("timezone-names");
tz.getTimezoneByName('Pacific Standard Time');
{
Abbreviation: 'PST',
Name: 'Pacific Standard Time',
DisplayName: 'Pacific Standard Time(UTC - 8)',
Offset: '-8 hours'
}
getTimezoneOffsetByName
Get timezone offset.
tz.getTimezoneOffsetByName('Pacific Standard Time');
{
Offset: '-8 hours',
Hours: -8,
Minutes: 0,
TotalMinutesOffset: -480
}
getAll
Get all timezones objects.
tz.getAll();
[
{
Abbreviation: 'PST',
Name: 'Pacific Standard Time',
DisplayName: 'Pacific Standard Time(UTC - 8)',
Offset: '-8 hours'
},
.
.
]