Skip to content

Format console times when a request has no Accept-Language - #60

Merged
slominskir merged 1 commit into
mainfrom
console-date-format
Oct 5, 2026
Merged

slominskir merged 1 commit into
mainfrom
console-date-format

Conversation

@slominskir-coding-agent

Copy link
Copy Markdown
Contributor

What changed

JSTL's fmt tags find the locale from the request's Accept-Language header, not from the server's default. With no header they print the value's toString(). So on /console, a request without the header, such as from a script, got the last update times as Mon Oct 05 19:10:48 UTC 2026 instead of the page's pattern, Oct 05 2026 19:10:48.

web.xml now sets JSTL's fallback locale (jakarta.servlet.jsp.jstl.fmt.fallbackLocale) to en-US. This applies to every page's fmt tags, including fmt:formatNumber on /console and /disconnected-pvs. Requests that send Accept-Language are unchanged; for example, de-DE still gets Okt. 05 2026.

This was noticed while adding the disconnected PVs report (#58).

Deployment

None.

Checks

  • ./gradlew spotlessCheck test: passed, 84 unit tests.

  • ./gradlew integrationTest, after rebuilding the image: passed, 27 tests. The new ConsoleTest checks that channel1's last update on /console follows the page's pattern when the request has no Accept-Language. It failed against the image without this change.

  • By hand with curl on /console, while monitoring HELLO:

    Accept-Language Before After
    none Mon Oct 05 19:10:48 UTC 2026 Oct 05 2026 19:13:33
    en-US Oct 05 2026 19:10:42 Oct 05 2026 19:13:33
    de-DE Okt. 05 2026 19:10:48 Okt. 05 2026 19:13:33

Decisions

  • One web.xml setting rather than formatting in Java. The disconnected PVs report formats its times in Java, so its JS can compare them as text. The console doesn't need that, and the fallback locale fixes every fmt tag at once while keeping the console's existing format.

🤖 Generated with Claude Code

JSTL's fmt tags find the locale from the request's Accept-Language
header, not the server's default, and with none they print the value's
toString(). So a request without the header, such as from a script,
got the console's last update times as "Mon Oct 05 19:10:48 UTC 2026"
instead of "Oct 05 2026 19:10:48". Set JSTL's fallback locale to en-US,
for every page's fmt tags.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@slominskir
slominskir merged commit 0d2c2aa into main Oct 5, 2026
6 checks passed
@slominskir
slominskir deleted the console-date-format branch October 5, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

source::ai Work done by an AI agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant