mirror of
https://github.com/openwrt/luci.git
synced 2025-12-21 19:14:34 +04:00
luci-proto-wireguard: Display times which account for the timezone also
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
'require rpc';
|
'require rpc';
|
||||||
'require poll';
|
'require poll';
|
||||||
'require dom';
|
'require dom';
|
||||||
|
'require uci';
|
||||||
'require ui';
|
'require ui';
|
||||||
|
|
||||||
|
|
||||||
@@ -27,7 +28,15 @@ function timestampToStr(timestamp) {
|
|||||||
else
|
else
|
||||||
ago = _('over a day ago');
|
ago = _('over a day ago');
|
||||||
|
|
||||||
return (new Date(timestamp * 1000)).toUTCString() + ' (' + ago + ')';
|
const date = new Date(timestamp * 1000);
|
||||||
|
const sys = uci.get('system', '@system[0]');
|
||||||
|
|
||||||
|
return new Intl.DateTimeFormat(undefined, {
|
||||||
|
dateStyle: 'medium',
|
||||||
|
timeStyle: (!sys?.clock_timestyle) ? 'long' : 'full',
|
||||||
|
hourCycle: (!sys?.clock_hourcycle) ? undefined : sys.clock_hourcycle,
|
||||||
|
timeZone: sys?.zonename?.replaceAll(' ', '_') || 'UTC',
|
||||||
|
}).format(date) + ' (' + ago + ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleInterfaceDetails(iface) {
|
function handleInterfaceDetails(iface) {
|
||||||
@@ -115,6 +124,12 @@ function renderPeerTable(instanceName, peers) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return view.extend({
|
return view.extend({
|
||||||
|
load() {
|
||||||
|
return Promise.all([
|
||||||
|
uci.load('system'),
|
||||||
|
])
|
||||||
|
},
|
||||||
|
|
||||||
renderIfaces: function(ifaces) {
|
renderIfaces: function(ifaces) {
|
||||||
var res = [
|
var res = [
|
||||||
E('h2', [ _('WireGuard Status') ])
|
E('h2', [ _('WireGuard Status') ])
|
||||||
|
|||||||
Reference in New Issue
Block a user