Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

country-timezone-list

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

country-timezone-list

Package to get general list of timezone.

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
168
decreased by-10.16%
Maintainers
1
Weekly downloads
 
Created
Source

#Timezone List GitHub license

NPM package

Installation:

npm

npm install country-timezone-list

yarn

yarn add country-timezone-list

Usage:

import { getTimezoneList, getTimezoneByCountry, getTimezoneGroupByCountryCode } from "country-timezone-list";

API

getTimezoneList()

const tz = getTimezoneList();

This method returns an array of time zones objects:

[
  // ...
  {
    name: 'Pacific/Niue',
    alternativeName: 'Niue Time',
    countryName: 'Niue',
    countryCode: 'NU',
    abbreviation: 'NUT',
    offset: '-11:00',
    rawOffsetInMinutes: -660,
    fullName: '(UTC-11:00) Pacific/Niue',
    fullAlternativeName: '(UTC-11:00) Niue Time'
  },
  // ...
];

getTimezoneByCountry( String countryCode )

const tz = getTimezoneByCountry('MY' || ['MY', 'ID']);

This method returns an array of time zones objects for particular country:

[
  {
    name: 'Asia/Kuala_Lumpur',
    alternativeName: 'Malaysia Time',
    countryName: 'Malaysia',
    countryCode: 'MY',
    abbreviation: 'MYT',
    offset: '+08:00',
    rawOffsetInMinutes: 480,
    fullName: '(UTC+08:00) Asia/Kuala_Lumpur',
    fullAlternativeName: '(UTC+08:00) Malaysia Time'
  },
  // ...
];

getTimezoneGroupByCountryCode()

const tz = getTimezoneGroupByCountryCode();

This method returns an array of time zones objects group by country:

[
  // ...
  {
    name: 'Indonesia',
    code: 'ID',
    data: [
      {
        name: 'Asia/Jakarta',
        alternativeName: 'Western Indonesia Time',
        countryName: 'Indonesia',
        countryCode: 'ID',
        abbreviation: 'WIB',
        offset: '+07:00',
        rawOffsetInMinutes: 420,
        fullName: '(UTC+07:00) Asia/Jakarta',
        fullAlternativeName: '(UTC+07:00) Western Indonesia Time'
      },
      {
        name: 'Asia/Makassar',
        alternativeName: 'Central Indonesia Time',
        countryName: 'Indonesia',
        countryCode: 'ID',
        abbreviation: 'WITA',
        offset: '+08:00',
        rawOffsetInMinutes: 480,
        fullName: '(UTC+08:00) Asia/Makassar',
        fullAlternativeName: '(UTC+08:00) Central Indonesia Time'
      },
      {
        name: 'Asia/Jayapura',
        alternativeName: 'Eastern Indonesia Time',
        countryName: 'Indonesia',
        countryCode: 'ID',
        abbreviation: 'WIT',
        offset: '+09:00',
        rawOffsetInMinutes: 540,
        fullName: '(UTC+09:00) Asia/Jayapura',
        fullAlternativeName: '(UTC+09:00) Eastern Indonesia Time'
      }
    ]
  },
  // ...
];

Keywords

FAQs

Package last updated on 26 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc