wallet-core/node_modules/time-zone/index.js

11 lines
343 B
JavaScript
Raw Normal View History

2017-08-14 05:01:11 +02:00
'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;
};