Git Product home page Git Product logo

tzlookup's Introduction

tzlookup NPM version Build Status

NodeJS Module for timezone lookup by geo location

Install

npm install tzlookup --save

Usage

const tz = require('tzlookup').tzNameAt;

console.log(tz(40.7092, -74.0151));
// => America/New_York

Also you can get all timezone names

var tzNames = require('tzlookup').tzNames;

console.log(tzNames.filter(function (name) { return /Europe/.test(name) }));
// => [ 'Europe/Amsterdam',
//      'Europe/Andorra',
//      'Europe/Athens',
//      'Europe/Belgrade',
//      ...

API

tzNameAt(lat, lon)

lat

Required
Type: Number

Latitude – number between -90 and +90.

lon

Required
Type: Number

Longitude – number between -180 and +180.

Function with two arguments – latitude and longitude. Throws TypeError if arguments is not a Number and RangeError if at least one of them is out of range.

tzNames

Returns the list of all known names of the timezones.

Lisense

MIT © Maxim Novikov

tzlookup's People

Contributors

m-novikov avatar

Watchers

James Cloos avatar Maxim Ponomarev avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.