Skip to content

A light and fast method of looking up timezones given the name of city.

Notifications You must be signed in to change notification settings

uulltt/city-timezones

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

city-timezones

A light and fast method of looking up timezones given the name of a city.

npm install city-timezones
var cityTimezones = require('city-timezones');

cityTimezones.lookupViaCity(city: string)

If a city is found, returns an array of possible matches with city, state, lat, lng, timezone. Returns an empty [] if nothing matches. Multiple cities can be found if they have the same name, i.e. Springfield. A U.S. based city will contain a state_ansi property which is the abbreviated form of a US State ANSI State Table

finding based on city name of Chicago:

const cityLookup = cityTimezones.lookupViaCity('Chicago')
console.log(cityLookup)

Will return:

[ { city: 'Chicago',
    city_ascii: 'Chicago',
    lat: 41.82999066,
    lng: -87.75005497,
    pop: 5915976,
    country: 'United States of America',
    iso2: 'US',
    iso3: 'USA',
    province: 'Illinois',
    exactCity: 'Chicago',
    exactProvince: 'IL',
    state_ansi: 'IL',
    timezone: 'America/Chicago' } ]

About

A light and fast method of looking up timezones given the name of city.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%