Skip to content

Commit

Permalink
fix time format
Browse files Browse the repository at this point in the history
New example:
2024. 02. 16. 12:55:54 (Europe/Budapest)
Aranyalma2 committed Feb 16, 2024
1 parent 6d8f2ff commit 2c2de04
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions middleware/device/getDevicesMW.js
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ module.exports = function (objectrepository) {
function calcOnlineAndTime(devices) {
for (let i = 0; i < devices.length; i++) {
devices[i].online = devices[i].lastSeenDate > new Date(Date.now() - 60000);
devices[i].lastSeenDate = convertESTto24Time(devices[i].lastSeenDate);
devices[i].lastSeenDate_converted = convertESTto24Time(devices[i].lastSeenDate);

}
return devices;
@@ -52,7 +52,7 @@ function convertESTto24Time(estDateString) {
const estDate = new Date(estDateString);

// Format the date in the 24-hour format
const formattedESTString = formatter.format(estDate);
const formattedESTString = `${formatter.format(estDate)} (Europe/Budapest)`;

return formattedESTString;
}
2 changes: 1 addition & 1 deletion views/inAppViews/devices.ejs
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@
<span class="text-danger fw-bold"><%= texts.Offline %></span>
<% } %>
</td>
<td><%= devices[i].lastSeenDate %></td>
<td><%= devices[i].lastSeenDate_converted %></td>
<td style="width: 20px; white-space: nowrap">
<a href="/devices/delete/<%=devices[i]._id %>" class="btn btn-block btn-danger"><i class="bi bi-trash-fill"></i></a>
</td>

0 comments on commit 2c2de04

Please sign in to comment.