microsoft / microsoft/BotFramework-WebChat
useLocalizeDate failed because the language is not in CLDR
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 1.8k
- Forks
- 1.6k
- Avg merge
- 22h 58m
- Merged PRs (30d)
- 2
Description
Screenshots

(It is okay to pass "en" to language. But not okay to pass "en-US".)
Version
4.8.0
Describe the bug
In useLocalizeDate.js, we are passing a language identifier of "en-US", but getLocaleString.js is expecting "en" instead (the one specified in CLDR).
If the language identifier is not found in the CLDR database, then, the dateFormatter() function will return undefined.
Steps to reproduce
- Run the hook
useLocalizeDate
Expected behavior
It should return the date in localized format.
Instead, it throw an exception:

Additional context
Related to https://github.com/microsoft/BotFramework-Emulator/issues/2119.
[Bug]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with useLocalizeDate.js and getLocaleString.js, then trace how dateFormatter() handles the "en-US" language identifier. Reproduce the issue by running the useLocalizeDate hook with "en-US" and confirm the localized date is returned without an exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, internationalization
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100