Skip to content

Make "Last Started" date format on dashboard match "Last Updated"#4229

Merged
springfall2008 merged 2 commits into
mainfrom
copilot/update-date-format-ui
Jul 11, 2026
Merged

Make "Last Started" date format on dashboard match "Last Updated"#4229
springfall2008 merged 2 commits into
mainfrom
copilot/update-date-format-ui

Conversation

Copilot AI commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

The "Status" panel on the main dashboard showed "Last Updated" and "Last Started" in two visually inconsistent formats right next to each other (2026-07-10 14:40:10.512590 vs 2026-07-10T01:10:39+0100).

Display fix

  • In get_status_html (web.py), last_started is now parsed with str2time and stripped of tzinfo before rendering, so it displays without the ISO T separator or timezone offset — matching the style of last_updated.
  • Storage of last_started is untouched (output.py still writes it via TIME_FORMAT); this is a display-only change.
  • Parse failures are now logged via self.log() instead of being silently swallowed.
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))

Tests

  • Added a case in test_web_functions.py covering get_status_html rendering, asserting the reformatted value appears and the raw ISO/timezone form does not.

Copilot AI linked an issue Jul 11, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Update date format for last started display Make "Last Started" date format on dashboard match "Last Updated" Jul 11, 2026
Copilot AI requested a review from springfall2008 July 11, 2026 08:57
@springfall2008 springfall2008 marked this pull request as ready for review July 11, 2026 10:07
Copilot AI review requested due to automatic review settings July 11, 2026 10:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes the “Last Started” timestamp in the web dashboard’s Status panel render in the same human-readable style as “Last Updated” (space-separated datetime without ISO T or timezone offset), while keeping the stored sensor value unchanged.

Changes:

  • Parse last_started in WebInterface.get_status_html() via str2time() and render it without tzinfo to match the adjacent last_updated style.
  • Log parse failures for last_started instead of silently swallowing them.
  • Add a web functions test to assert the reformatted “Last Started” output is shown and the raw stored ISO+offset form is not.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
apps/predbat/web.py Normalizes last_started display formatting in the status HTML and logs parse failures.
apps/predbat/tests/test_web_functions.py Adds coverage asserting get_status_html() renders “Last Started” in the expected format.

@springfall2008 springfall2008 merged commit bf8f848 into main Jul 11, 2026
3 checks passed
@springfall2008 springfall2008 deleted the copilot/update-date-format-ui branch July 11, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Date format inconsistencies

3 participants