Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions apps/predbat/tests/test_web_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,23 @@ def set_exporting(on):

my_predbat.dashboard_index = original_dashboard_index

# -------------------------------------------------------------------------
# Last Started/Last Updated date format consistency (issue #4223)
print("Test: Last Started date is displayed in the same format as Last Updated")
status_entity = prefix + ".status"
last_started_entity = prefix + ".last_started"
set_entity(my_predbat, status_entity, state="Idle", last_updated="2026-07-10 14:40:10.512590")
set_entity(my_predbat, last_started_entity, state="2026-07-10T01:10:39+0100")
my_predbat.dashboard_index = [status_entity]
status_html = web.get_status_html("1.0")
my_predbat.dashboard_index = original_dashboard_index
if "2026-07-10 01:10:39" not in status_html:
print(f" ERROR: expected 'Last Started' to be reformatted without 'T'/timezone offset, got: {status_html}")
failed += 1
if "2026-07-10T01:10:39+0100" in status_html:
print(f" ERROR: 'Last Started' should not show the raw stored ISO format, got: {status_html}")
failed += 1

# -------------------------------------------------------------------------
# Currency unit display in the web config pages (issue #4071)
# The web UI must show the user's configured currency symbol, not the raw "p".
Expand Down
5 changes: 5 additions & 0 deletions apps/predbat/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,11 @@ def get_status_html(self, version):
text += "<tr><td>Status</td><td{}>{}</td></tr>\n".format(debug_title, status_full)
text += "<tr><td>Last Updated</td><td>{}</td></tr>\n".format(last_updated)
last_started = self.get_state_wrapper(self.prefix + ".last_started", default=None)
if last_started:
try:
last_started = str2time(last_started).replace(tzinfo=None)
except (ValueError, TypeError) as e:
self.log("Warn: Failed to parse last_started time {}: {}".format(last_started, e))
text += "<tr><td>Last Started</td><td>{}</td></tr>\n".format(last_started)
text += "<tr><td>Version</td><td>{}</td></tr>\n".format(version)

Expand Down
Loading