Skip to content

fix: datetime displays now respect the app's selected locale#2366

Open
GiulioSavini wants to merge 2 commits intogetarcaneapp:mainfrom
GiulioSavini:fix/datetime-locale-formatting
Open

fix: datetime displays now respect the app's selected locale#2366
GiulioSavini wants to merge 2 commits intogetarcaneapp:mainfrom
GiulioSavini:fix/datetime-locale-formatting

Conversation

@GiulioSavini
Copy link
Copy Markdown
Contributor

@GiulioSavini GiulioSavini commented Apr 13, 2026

What

Several components were calling toLocaleString() / toLocaleTimeString() without passing a locale argument, so date displays always followed the OS system locale regardless of what language the user picked inside Arcane.

Fix

Added formatDateTime and formatDateTimeShort utilities to locale.util.ts backed by date-fns, which already picks up the paraglide locale via setDefaultOptions (set when the user changes language). Updated the five affected components:

  • event-details-dialog.svelte
  • docker-info-dialog.svelte
  • job-card.svelte
  • vulnerability-scan-item.svelte
  • vulnerability-scan-panel.svelte

No behaviour change for users who haven't changed locale. For everyone else, dates now match the language they selected.

Fixes #2349

Disclaimer Greptiles Reviews use AI, make sure to check over its work.

To better help train Greptile on our codebase, if the comment is useful and valid Like the comment, if its not helpful or invalid Dislike

To have Greptile Re-Review the changes, mention greptileai.

Greptile Summary

This PR adds formatDateTime / formatDateTimeShort helpers to locale.util.ts backed by date-fns, then updates five components to use them so that date displays respect the user's in-app locale choice rather than the OS locale.

  • In vulnerability-scan-item.svelte the original call was toLocaleTimeString() (time-only), but the replacement is formatDateTime() which outputs the full date + time via the 'PPpp' pattern. This is a visible format change for all users regardless of locale, and may overflow UI elements sized for a time-only string.

Confidence Score: 4/5

Safe to merge after confirming whether the time-only → date+time change in vulnerability-scan-item is intentional.

Four of the five component changes are clean locale-only fixes. The one issue — toLocaleTimeString() replaced by formatDateTime() in vulnerability-scan-item.svelte — changes the displayed information (time-only → date+time) for every user, which is a real behaviour change that should be explicitly confirmed before merging.

frontend/src/lib/components/vulnerability/vulnerability-scan-item.svelte

Fix All in Codex

Prompt To Fix All With AI
This is a comment left during a code review.
Path: frontend/src/lib/components/vulnerability/vulnerability-scan-item.svelte
Line: 87

Comment:
**Unintentional format change: time-only → date+time**

The original call was `parsed.toLocaleTimeString()`, which outputs only the time portion (e.g., `"3:45:22 PM"`). `formatDateTime` uses the `'PPpp'` pattern, which outputs the full date + time (e.g., `"Apr 13, 2026, 3:45:22 PM"`). For every user — including those who never changed the app's locale — `scanStartedLabel` now displays a much longer string, which may overflow any UI elements sized for a time-only value and contradicts the PR's stated goal of no behaviour change for users on the default locale.

If including the date is intentional, that's fine, but it should be called out explicitly. If the intent was purely a locale fix, `formatDateTimeShort` at minimum (or a time-only `date-fns` helper) is the correct replacement.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix: use app locale for datetime formatt..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

date displays across event details, docker info, job cards, and vuln
scans were calling toLocaleString() with no locale argument, which
ignores whatever language the user picked in the app and falls back to
the OS setting. route everything through formatDateTime/formatDateTimeShort
utilities backed by date-fns, which already picks up the paraglide
locale set via setDefaultOptions.

fixes getarcaneapp#2349
@kmendell
Copy link
Copy Markdown
Member

kmendell commented Apr 13, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

const parsed = new Date(ts);
if (Number.isNaN(parsed.getTime())) return m.common_na();
return parsed.toLocaleTimeString();
return formatDateTime(parsed);
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.

P1 Unintentional format change: time-only → date+time

The original call was parsed.toLocaleTimeString(), which outputs only the time portion (e.g., "3:45:22 PM"). formatDateTime uses the 'PPpp' pattern, which outputs the full date + time (e.g., "Apr 13, 2026, 3:45:22 PM"). For every user — including those who never changed the app's locale — scanStartedLabel now displays a much longer string, which may overflow any UI elements sized for a time-only value and contradicts the PR's stated goal of no behaviour change for users on the default locale.

If including the date is intentional, that's fine, but it should be called out explicitly. If the intent was purely a locale fix, formatDateTimeShort at minimum (or a time-only date-fns helper) is the correct replacement.

Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/src/lib/components/vulnerability/vulnerability-scan-item.svelte
Line: 87

Comment:
**Unintentional format change: time-only → date+time**

The original call was `parsed.toLocaleTimeString()`, which outputs only the time portion (e.g., `"3:45:22 PM"`). `formatDateTime` uses the `'PPpp'` pattern, which outputs the full date + time (e.g., `"Apr 13, 2026, 3:45:22 PM"`). For every user — including those who never changed the app's locale — `scanStartedLabel` now displays a much longer string, which may overflow any UI elements sized for a time-only value and contradicts the PR's stated goal of no behaviour change for users on the default locale.

If including the date is intentional, that's fine, but it should be called out explicitly. If the intent was purely a locale fix, `formatDateTimeShort` at minimum (or a time-only `date-fns` helper) is the correct replacement.

How can I resolve this? If you propose a fix, please make it concise.

Fix in Codex

review caught that toLocaleTimeString() was time-only but formatDateTime
switched it to full date+time, which would overflow the UI element.
added formatTime utility (date-fns 'pp' pattern) and swapped it in.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

⚡️ Feature: Make datetime representations respect locale

2 participants