fix: respect locale date order for Asian languages in DatePresenter #10779#10781
Open
Learnobug wants to merge 2 commits intohcengineering:developfrom
Open
fix: respect locale date order for Asian languages in DatePresenter #10779#10781Learnobug wants to merge 2 commits intohcengineering:developfrom
Learnobug wants to merge 2 commits intohcengineering:developfrom
Conversation
|
Connected to Huly®: UBERF-16321 |
Signed-off-by: Learnobug <gunjanaggarwal12345@gmail.com>
80c4d79 to
5f293a8
Compare
Member
|
@Learnobug Thank you for your contribution. Could you please fix formatting ( |
Signed-off-by: Learnobug <gunjanaggarwal12345@gmail.com>
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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