From c480e0343d58a020bde1497189fe4eafb1c2d3f2 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 26 Jan 2024 16:22:11 +0100 Subject: [PATCH] Fix interpretation of lease expiration field in case it is 0. This does not mean 1st of January 1970 but really a never expiring lease Signed-off-by: DL6ER --- scripts/pi-hole/js/utils.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/pi-hole/js/utils.js b/scripts/pi-hole/js/utils.js index 9a6c20de..54554538 100644 --- a/scripts/pi-hole/js/utils.js +++ b/scripts/pi-hole/js/utils.js @@ -152,6 +152,10 @@ function showAlert(type, icon, title, message) { } function datetime(date, html, humanReadable) { + if (date === 0 && humanReadable) { + return "Never"; + } + var format = html === false ? "Y-MM-DD HH:mm:ss z" : "Y-MM-DD []HH:mm:ss z"; var timestr = moment.unix(Math.floor(date)).format(format).trim(); return humanReadable