1

What is the simplest and best way to get the timezone from an ip in node.js? Ideally without calling a webservice (any free webservice solutions are also welcome).

Uptil now I have managed to find the 2 letter ISO-3166-1 country code, latitude/longitude, ISO-3166-2 subcountry code, FIPS 10-4 subcountry code and the city name from the npm module geoip-lite.

How would I go about translating this data to a timezone or a utc offset? Or maybe an easier way is to directly map the ip to the timezone.

Aymen Rizwan
  • 47
  • 1
  • 7
  • See http://stackoverflow.com/questions/16086962/how-to-get-a-time-zone-from-a-location-using-latitude-and-longitude-coordinates – Evan Siroky Feb 15 '17 at 18:17

1 Answers1

5

satelize can do that.

var satelize = require('satelize');
satelize.satelize({ip:'46.19.37.108'}, function(err, payload) {
});

Output includes timezone

{
    "ip": "46.19.37.108",
    "continent_code": "EU",
    "continent": {
      "de": "Europa",
      "en": "Europe"
    },
    "country_code": "NL",
    "country": {
      "de": "Niederlande",
      "en": "Netherlands"
    },
    "latitude": 52.5,
    "longitude": 5.75,
    "timezone":"Europe/Amsterdam"
}
Tuan Anh Tran
  • 6,807
  • 6
  • 37
  • 54