Question / Feature request regarding localized time format
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
This may be possible, but I couldn't find it in the docs. I would like to display a time in a users locally preferred format—either 24h or 12h with am/pm. I tried `localizedFormat` with 'LT', but that gives me `1:36 PM` in the UK, where the preferred time format is 24h (as returned by `new Date().toLocaleString()`.
Is there a way to show a time _either_ as `HH:mm` or `h:mm a` depending on the user's locale / machine preferences?
Contributor guide
Research direction
Start by examining the localizedFormat plugin's handling of the LT token and compare it with the behavior of new Date().toLocaleString(). Determine how locale or machine preferences can select 24-hour versus 12-hour output, then add coverage showing the expected HH:mm or h:mm a result for each preference.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- internationalization
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100