Skip to content
Snippets Groups Projects
Commit 827afb46 authored by Éloïs's avatar Éloïs
Browse files

[enh] get timezone offset

parent a14ff2a8
No related branches found
No related tags found
1 merge request!62Dev2
......@@ -3,13 +3,18 @@
const co = require('co');
const webserver = require(__dirname + '/webserver.js');
//const duniter = require(__dirname + '/duniter.js');
const timestampToDatetime = require(__dirname + '/timestampToDatetime.js');
/****************************
* Main algorithm
*/
module.exports = (duniterServer, host, port, appParente, program) => co(function *() {
// Get local timezone offset
var x = new Date();
var offset = -x.getTimezoneOffset();
//timestampToDatetime(1000000, true, offset);
// Define cache
var cache = {
// membersCount
......@@ -34,7 +39,7 @@ module.exports = (duniterServer, host, port, appParente, program) => co(function
console.log("module currency-monit started");
// Specialized node's UI
let httpServer = webserver(host, port, appParente, duniterServer, cache);
let httpServer = webserver(host, port, appParente, duniterServer, offset, cache);
yield httpServer.openConnection();
})
......
module.exports = function timestampToDatetime(timestamp, onlyDate = false) {
// cache offset
var offset = 0;
module.exports = function timestampToDatetime(timestamp, onlyDate = false, offset_ = 0) {
if (offset_ != 0) {
offset = offset_;
}
// Apply offset
timestamp += offset*60; // offset is in minutes
// Convertir le timestamp en datetime
let tmptimestampExpireCertif = new Date(timestamp*1000);//tmpQueryGetTimeWrittenCert[0].medianTime)*1000);
let tmptimestampExpireCertifDay = tmptimestampExpireCertif.getDate();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment