From ac2b0f539c549899a842eae349ecaf3eb0ce2ca3 Mon Sep 17 00:00:00 2001 From: padreug Date: Wed, 18 Jun 2025 16:14:33 +0200 Subject: [PATCH] Implement date and time formatting for polling information in Lamassu configuration: add formatDateTime method to enhance date display, update UI to utilize new formatting for last poll and last successful poll timestamps. --- static/js/index.js | 7 +++++++ templates/myextension/index.html | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/static/js/index.js b/static/js/index.js index f812676..98277f5 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -133,6 +133,13 @@ window.app = Vue.createApp({ return new Date(dateString).toLocaleDateString() }, + formatDateTime(dateString) { + if (!dateString) return '' + const date = new Date(dateString) + return date.toLocaleDateString() + ' ' + date.toLocaleTimeString('en-US', { hour12: false }) + }, + + // Configuration Methods async getLamassuConfig() { try { diff --git a/templates/myextension/index.html b/templates/myextension/index.html index 6c5ecdf..d4c4dee 100644 --- a/templates/myextension/index.html +++ b/templates/myextension/index.html @@ -346,8 +346,8 @@ Failed Not tested

-

Last Poll: ${ lamassuConfig.last_poll_time ? formatDate(lamassuConfig.last_poll_time) : 'Not yet run' }

-

Last Success: ${ lamassuConfig.last_successful_poll ? formatDate(lamassuConfig.last_successful_poll) : 'Never' }

+

Last Poll: ${ lamassuConfig.last_poll_time ? formatDateTime(lamassuConfig.last_poll_time) : 'Not yet run' }

+

Last Success: ${ lamassuConfig.last_successful_poll ? formatDateTime(lamassuConfig.last_successful_poll) : 'Never' }

Status: Not configured