Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure dates are formatted with the current app locale (and not browser default) #1697

Merged
merged 3 commits into from
Apr 20, 2024

Conversation

emma-sg
Copy link
Member

@emma-sg emma-sg commented Apr 18, 2024

Motivation

While using the browser default locale is often good enough, we probably want more full control over locales, especially when we allow users to choose their own locale — it's a poor experience to not have dates and numbers formatted consistently with your chosen locale.

Changes

Ensures (almost) all instances of <sl-format-date> as well as Intl.* have the correct locale passed into them from our Lit localization system.

The one exception here is in frontend/src/utils/number.ts where ordinal suffixes aren't localized, so the locale is hardcoded to en — I'll revisit this in the future.

@Shrinks99
Copy link
Member

Hype

@emma-sg emma-sg requested review from Shrinks99 and SuaYoo April 19, 2024 05:19
@SuaYoo
Copy link
Member

SuaYoo commented Apr 19, 2024

Nice, thanks for this! Looks like we can remove the TODO comments?

@emma-sg emma-sg merged commit c5b808b into main Apr 20, 2024
2 checks passed
@emma-sg emma-sg deleted the frontend-locale-aware-date-formatting branch April 20, 2024 20:30
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.

3 participants