mirror of
https://git.openwrt.org/project/luci.git
synced 2025-12-20 08:49:59 +08: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 poll';
|
||||
'require dom';
|
||||
'require uci';
|
||||
'require ui';
|
||||
|
||||
|
||||
@@ -27,7 +28,15 @@ function timestampToStr(timestamp) {
|
||||
else
|
||||
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) {
|
||||
@@ -115,6 +124,12 @@ function renderPeerTable(instanceName, peers) {
|
||||
}
|
||||
|
||||
return view.extend({
|
||||
load() {
|
||||
return Promise.all([
|
||||
uci.load('system'),
|
||||
])
|
||||
},
|
||||
|
||||
renderIfaces: function(ifaces) {
|
||||
var res = [
|
||||
E('h2', [ _('WireGuard Status') ])
|
||||
|
||||
Reference in New Issue
Block a user