Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

inversed offset

  • Loading branch information...
commit 642ff8ca24e633cdb4c6dd52002953db1d023c61 1 parent 335168c
@olalonde authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 index.js
View
6 index.js
@@ -34,19 +34,19 @@ Client.prototype.geolocate = function (ip, cb) {
});;
}
function timezone2timezoneOffset(timezone) {
+ //console.log(timezone);
+ if (timezone.length <= 1) return 0;
timezone = timezone.split(':');
var hours = parseInt(timezone[0], 10);
var minutes = parseInt(timezone[1], 10);
if (hours < 0) minutes = -minutes;
// convert to minutes
- return hours * 60 + minutes;
+ return -1 * (hours * 60 + minutes);
};
Client.prototype.ip2timezoneOffset = function (ip, cb) {
this.geolocate(ip, function (err, res) {
if (err) return cb(err);
-
- console.log(res.timeZone);
cb(null, timezone2timezoneOffset(res.timeZone));
});
}
Please sign in to comment.
Something went wrong with that request. Please try again.