GT2/GT2-iOS/node_modules/jsonwebtoken/.history/lib/timespan_20170513162630.js

17 lines
471 B
JavaScript
Raw Normal View History

2018-02-12 17:26:06 +00:00
var ms = require('ms');
module.exports = function (timeOffset, currentTimestamp) {
currentTimestamp = iat || Math.floor(Date.now() / 1000);
if (typeof timeOffset === 'string') {
var milliseconds = ms(timeOffset);
if (typeof milliseconds === 'undefined') {
return;
}
return Math.floor(currentTimestamp + milliseconds / 1000);
} else if (typeof timeOffset === 'number') {
return currentTimestamp + timeOffset;
} else {
return;
}
};