wallet-core/node_modules/time-zone/index.js
2017-08-14 05:02:09 +02:00

11 lines
343 B
JavaScript

'use strict';
module.exports = date => {
const offset = (date || new Date()).getTimezoneOffset();
const absOffset = Math.abs(offset);
const hours = Math.floor(absOffset / 60);
const minutes = absOffset % 60;
const minutesOut = minutes > 0 ? ':' + ('0' + minutes).slice(-2) : '';
return (offset < 0 ? '+' : '-') + hours + minutesOut;
};