fix: datetime displays now respect the app's selected locale#2366
fix: datetime displays now respect the app's selected locale#2366GiulioSavini wants to merge 2 commits intogetarcaneapp:mainfrom
Conversation
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
✅ Snyk checks have passed. No issues have been found so far.
💻 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); |
There was a problem hiding this 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.
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.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.
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
formatDateTimeandformatDateTimeShortutilities tolocale.util.tsbacked bydate-fns, which already picks up the paraglide locale viasetDefaultOptions(set when the user changes language). Updated the five affected components:event-details-dialog.sveltedocker-info-dialog.sveltejob-card.sveltevulnerability-scan-item.sveltevulnerability-scan-panel.svelteNo 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/formatDateTimeShorthelpers tolocale.util.tsbacked bydate-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.vulnerability-scan-item.sveltethe original call wastoLocaleTimeString()(time-only), but the replacement isformatDateTime()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
Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "fix: use app locale for datetime formatt..." | Re-trigger Greptile