luci-mod-status: 10_system.js: fix local time display
[project/luci.git] / modules / luci-mod-status / htdocs / luci-static / resources / view / status / include / 10_system.js
index 8ac7e7cdae2ce075a3e5e37d13a9272fa2526163..4a35175290d2c6025bed17b19da9af82239eb105 100644 (file)
@@ -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,