iamkun / iamkun/dayjs

Year format incorrect

Open
#1,834 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

**Describe the bug**

Open console panel in https://dayjs.gitee.io/zh-CN/
input:
```js
dayjs(-62140000000000).toDate(); // Sat Nov 11 0000 08:59:03 GMT+0805 (中国标准时间)

dayjs(-62140000000000).format('YYYY'); // '+0800' should be '0'
```

**Expected behavior**
return '0';

**Information**
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.83 Safari/537.36

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue in the Day.js console with dayjs(-62140000000000).toDate() and format('YYYY'), using the linked Chinese demo as the entry point. Trace the year-formatting path and add or update coverage for year 0; done means format('YYYY') returns '0' for this input without breaking nearby year cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.