diff --git a/public/src/admin/settings/email.js b/public/src/admin/settings/email.js index 336abf34fa..3e3fdc1280 100644 --- a/public/src/admin/settings/email.js +++ b/public/src/admin/settings/email.js @@ -87,18 +87,20 @@ define('admin/settings/email', ['ace/ace', 'admin/settings'], function (ace) { return app.alertError(err.message); } - now = new Date(now); + var date = new Date(now.timestamp); + var offset = (new Date().getTimezoneOffset() - now.offset) / 60; + date.setHours(date.getHours() + offset); - $('#serverTime').text(now.toString()); + $('#serverTime').text(date.toLocaleTimeString()); - now.setHours(parseInt(hour, 10), 0, 0, 0); + date.setHours(parseInt(hour, 10) - offset, 0, 0, 0); // If adjusted time is in the past, move to next day - if (now.getTime() < Date.now()) { - now.setDate(now.getDate() + 1); + if (date.getTime() < Date.now()) { + date.setDate(date.getDate() + 1); } - $('#nextDigestTime').text(now.toString()); + $('#nextDigestTime').text(date.toLocaleString()); }); } diff --git a/src/socket.io/meta.js b/src/socket.io/meta.js index 398bf249f5..e9cd3f00e4 100644 --- a/src/socket.io/meta.js +++ b/src/socket.io/meta.js @@ -62,7 +62,12 @@ function leaveCurrentRoom(socket) { SocketMeta.getServerTime = function (socket, data, callback) { // Returns server time in milliseconds - callback(null, Date.now()); + const now = new Date(); + + callback(null, { + timestamp: now.getTime(), + offset: now.getTimezoneOffset(), + }); }; module.exports = SocketMeta;