iamkun / iamkun/dayjs

`z` timezone formatting option doesn't formatting as expected

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

Description

**Describe the bug**
while trying to format a value using `z` it returns zone offset instead of abbreviated offset

```
const date = dayjs.tz('2024-12-22T16:21:11+05:30', 'Asia/Kolkata');
console.log(date.format('z')); // Expected: IST
console.log(date.format('Z')); // Expected: +05:30
```

instead of the above expected OP for `z` formatting it returns `GMT:+5:30`

I have tried using `advancedFormat` plugin too still im facing the issue

**Expected behavior**

`z` will be transformed abbreviated offset name correctly according to [(https://day.js.org/docs/en/plugin/advanced-format)]

**Information**
- Day.js Version [1.11.13]
- OS: [Ubuntu 24.04.1 LTS]
- Browser [all browser]
- Time zone: [ GMT+05:30 IST (Indian Standard Time)]

Contributor guide

Open the contributing guide

Research direction

Start with the advancedFormat plugin and reproduce the reported dayjs.tz example from the issue. Check how format('z') and format('Z') behave for Asia/Kolkata; done means z produces the abbreviated zone name expected by the documented behavior while Z remains +05:30.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
internationalization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.