From: Jo-Philipp Wich Date: Tue, 5 Nov 2019 21:15:01 +0000 (+0100) Subject: luci-mod-status: 10_system.js: fix local time display X-Git-Url: http://git.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=b27b5cfb51de91af90a05a6f31dba7511dedf8b7;ds=sidebyside luci-mod-status: 10_system.js: fix local time display Signed-off-by: Jo-Philipp Wich --- diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/10_system.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/10_system.js index 8ac7e7cdae..4a35175290 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/10_system.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/10_system.js @@ -34,13 +34,28 @@ return L.Class.extend({ return l.replace(/^\s*\w+\s*=\s*['"]([^'"]+)['"].*$/, '$1'); }).join(' '); + var datestr = null; + + if (systeminfo.localtime) { + var date = new Date(systeminfo.localtime * 1000); + + datestr = '%04d-%02d-%02d %02d:%02d:%02d'.format( + date.getUTCFullYear(), + date.getUTCMonth() + 1, + date.getUTCDate(), + date.getUTCHours(), + date.getUTCMinutes(), + date.getUTCSeconds() + ); + } + var fields = [ _('Hostname'), boardinfo.hostname, _('Model'), boardinfo.model, _('Architecture'), boardinfo.system, _('Firmware Version'), (L.isObject(boardinfo.release) ? boardinfo.release.description + ' / ' : '') + (luciversion || ''), _('Kernel Version'), boardinfo.kernel, - _('Local Time'), systeminfo.localtime ? (new Date(systeminfo.localtime * 1000)).toLocaleString() : null, + _('Local Time'), datestr, _('Uptime'), systeminfo.uptime ? '%t'.format(systeminfo.uptime) : null, _('Load Average'), Array.isArray(systeminfo.load) ? '%.2f, %.2f, %.2f'.format( systeminfo.load[0] / 65535.0,