Skip to content

Commit aa60f50

Browse files
committed
[monitoring/js] Consistent datetime format in RADIUS sessions tab #662
Use Django locale for date formatting in device page RADIUS sessions tab JS, matching Django admin and localization settings. Fixes #662
1 parent d2854e2 commit aa60f50

File tree

1 file changed

+11
-1
lines changed
  • openwisp_radius/integrations/monitoring/static/radius-monitoring/js

1 file changed

+11
-1
lines changed

openwisp_radius/integrations/monitoring/static/radius-monitoring/js/device-change.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,17 @@
1919
// This is done to show the time in server's timezone
2020
// because RadiusAccounting admin also shows the time in server's timezone.
2121
let strippedDateTime = new Date(dateTimeString.replace(/[-+]\d{2}:\d{2}$/, ""));
22-
return strippedDateTime.toLocaleString();
22+
const locale = djangoLocale.replace("_", "-");
23+
const options = {
24+
year: "numeric",
25+
month: "short",
26+
day: "numeric",
27+
hour: "2-digit",
28+
minute: "2-digit",
29+
second: "2-digit",
30+
hour12: false,
31+
};
32+
return strippedDateTime.toLocaleString(locale, options);
2333
}
2434

2535
function fetchRadiusSessions() {

0 commit comments

Comments
 (0)