us-timezones-name
Version:
Library to get timezone details by Name
62 lines (44 loc) • 1.23 kB
Markdown
Library to get us timezone details. Functions accept timezone names and abbreviations
Get timezone info object by timezone name.
``` js
import tz from 'us-timezones-name';
tz.getTimeZoneByName( 'Pacific Standard Time' );
// Returns
{
Abbreviation: 'PST', //Abbreviation for the timezone
Name: 'Pacific Standard Time', //Standard Name
DisplayName: 'Pacific Standard Time(UTC - 8)', //Display String
Offset: '-8 hours' //Offset string
}
```
Get timezone info object by timezone abbreviation.
``` js
tz.getTimeZoneByAbbreviation( 'PST' );
// Returns
{
Abbreviation: 'PST', //Abbreviation for the timezone
Name: 'Pacific Standard Time', //Standard Name
DisplayName: 'Pacific Standard Time(UTC - 8)', //Display String
Offset: '-8 hours' //Offset string
}
```
Get all timezones objects.
``` js
tz.getAll();
// Returns Array of timezone objects
[
{
Abbreviation: 'PST', //Abbreviation for the timezone
Name: 'Pacific Standard Time', //Standard Name
DisplayName: 'Pacific Standard Time(UTC - 8)', //Display String
Offset: '-8 hours' //Offset string
},
.
.
]
```