Skip to content

fix: respect locale date order for Asian languages in DatePresenter #10779#10781

Open
Learnobug wants to merge 2 commits intohcengineering:developfrom
Learnobug:fix/datetime-locale-order
Open

fix: respect locale date order for Asian languages in DatePresenter #10779#10781
Learnobug wants to merge 2 commits intohcengineering:developfrom
Learnobug:fix/datetime-locale-order

Conversation

@Learnobug
Copy link
Copy Markdown

@Learnobug Learnobug commented Apr 18, 2026

Problem

DatePresenter and DateRangePresenter were hardcoding the Western day-month-year display order (25 Mar 2025) by manually concatenating date parts in the template. This ignored the user's locale, causing incorrect and confusing date display for Asian languages:

Korean (ko): should be 2025년 3월 25일
Japanese (ja): should be 2025年3月25日
Chinese (zh): should be 2025年3月25日

Solution
Added a formatDate() utility in DateUtils.ts that uses Intl.DateTimeFormat with the browser's resolved locale, which natively produces the correct ordering for all languages.

Replaced all hardcoded {day} {month} {year} template concatenations with formatDate() in:

DatePresenter.svelte
DateRangePresenter.svelte (both inline and button display modes)

Testing
Set browser language to Japanese/Korean/Chinese and verify dates render in correct YYYY-MM-DD hierarchy
Verify Western locales (en, fr, de) still display correctly as Mar 25 or Mar 25, 2025

@huly-github-staging
Copy link
Copy Markdown

Connected to Huly®: UBERF-16321

Signed-off-by: Learnobug <gunjanaggarwal12345@gmail.com>
@BykhovDenis
Copy link
Copy Markdown
Member

@Learnobug Thank you for your contribution. Could you please fix formatting (cd packages/ui && rushx format -f)

Signed-off-by: Learnobug <gunjanaggarwal12345@gmail.com>
@Learnobug
Copy link
Copy Markdown
Author

Playwright e2e test failure is unrelated to this change — it requires a running server at localhost:3003 which is unavailable in CI for fork PRs. The formatting fix has been applied. All changes are scoped to DateUtils.ts, DatePresenter.svelte, and DateRangePresenter.svelte

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.

2 participants