timezone-offset-to
Advanced tools
Comparing version 0.0.0 to 0.1.0
44
index.js
@@ -1,22 +0,32 @@ | ||
var parse = function(offset) { | ||
offset = offset || "" | ||
var tz = 0 | ||
var tzRX = /(-?)(\d{1,2}):??(\d{2})/ | ||
var match = offset.match(tzRX) | ||
if (match) tz = parseInt(match.slice(1,4).join(''), 10) | ||
return tz | ||
} | ||
!function (name, definition) { | ||
if (typeof module != 'undefined') module.exports = definition() | ||
else if (typeof define == 'function' && typeof define.amd == 'object') define(definition) | ||
else this[name] = definition() | ||
}('tzto', function () { | ||
var tzTo = module.exports = { | ||
var parse = function(offset) { | ||
offset = offset || "" | ||
var tz = 0 | ||
var tzRX = /(-?)(\d{1,2}):??(\d{2})/ | ||
var match = offset.match(tzRX) | ||
if (match) tz = parseInt(match.slice(1,4).join(''), 10) | ||
return tz | ||
} | ||
minutes: function(offset) { | ||
var tz = parse(offset) | ||
return (((tz / 100) | 0) * 60) + tz % 100 | ||
}, | ||
var tzto = { | ||
hours: function(offset) { | ||
var tz = parse(offset) | ||
return ((tz / 100) | 0) + ((tz % 100) / 60) | ||
minutes: function(offset) { | ||
var tz = parse(offset) | ||
return (((tz / 100) | 0) * 60) + tz % 100 | ||
}, | ||
hours: function(offset) { | ||
var tz = parse(offset) | ||
return ((tz / 100) | 0) + ((tz % 100) / 60) | ||
} | ||
} | ||
} | ||
return tzto | ||
}) |
{ | ||
"name": "timezone-offset-to", | ||
"version": "0.0.0", | ||
"version": "0.1.0", | ||
"description": "convert a timezone offset to a numerical value", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
2258
49