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

city-country-timezone

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

city-country-timezone

Find the timezone from countries given or city and country indicated.

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

city-country-timezone

NPM

Find timezone of any country, city or province

About

By passing a country, province or city you would get an object with the timezone of that location you indicated and then the difference in hours between that location you indicated and the location where the code is running (know as time_diff). The location used to test this code is Odessa, Ukraine which would determine the outcome of the time_diff

Getting Started

Installation

npm install city-country-timezone

Code snippet

Search by city
const getTimeDiffAndTimeZone = require('city-country-timezone');

const country = "Los Angeles"; //city

const { timezone, time_diff } = getTimeDiffAndTimeZone(country);

console.log(`Timezone: ${timezone}, Time Difference: ${time_diff}`); 
// Timezone: America/Santiago, Time Difference: -5
Search by region and country
const getTimeDiffAndTimeZone = require('city-country-timezone');

const country = "Samara Region, Russian Federation"; //region and country

const { timezone, time_diff } = getTimeDiffAndTimeZone(country);

console.log(`Timezone: ${timezone}, Time Difference: ${time_diff}`); 
// Timezone: Europe/Moscow, Time Difference: +1
Search by city and country
const getTimeDiffAndTimeZone = require('city-country-timezone');

const country = "Lagos, Nigeria"; //city and country

const { timezone, time_diff } = getTimeDiffAndTimeZone(country);

console.log(`Timezone: ${timezone}, Time Difference: ${time_diff}`); 
// Timezone: Africa/Lagos, Time Difference: -1

Keywords

FAQs

Package last updated on 15 Apr 2019

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