iamkun / iamkun/dayjs

Use locale for DateTimeFormat timezone names

Open
#2,933 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

Currently the `DateTimeFormat` that is created uses `en-US` as the locale. However this is not sufficent to include the desired timezone name.
https://github.com/iamkun/dayjs/blob/1d8746c23bd667bde80ee627a915301ebd69e1a2/src/plugin/timezone/index.js#L15-L34

For example:
```ts
getDateTimeFormat('Australia/Sydney').format(new Date())
// '09/15/2025, 09:39:52 GMT+10'
```
whereas if it was switched to `en-AU` we get the following
```ts
getDateTimeFormat('Australia/Sydney').format(new Date())
// '15/09/2025, 09:39:52 AEST'
```
Notice that with `en-US` the timezone is `GMT+10` but with `en-AU` it is `AEST`.

I would like to request a change such that the `dayjs.locale` set by imports like `import 'dayjs/locale/en-au'` is also used when constructing the `DateTimeFormat`.

Contributor guide

Open the contributing guide

Research direction

Start in src/plugin/timezone/index.js at the linked getDateTimeFormat implementation and inspect how the active dayjs locale is exposed. Verify the formatter's timezone-name output for Australia/Sydney with en-US and en-AU; done means the configured dayjs locale is used and the expected localized timezone name is produced.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
internationalization
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.