.fomat is adding an extra month
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Bug arises while formatting javascript date object, to reproduce:
- run the following code snippet.
```js
import dayjs from 'dayjs'
const test = new Date('2020-01-01') // '02/01/2022'
const result = dayjs(test).format('DD/MM/YYYY')
```
- Also happen with `new Date(2020, 1, 1)` constructor
**Expected behavior**
`result` should be '01/01/2020', instead I get


**Information**
- Day.js Version v.1.11.7
- OS: Linux, Pop_OS
- Browser: Brave
- Time zone: GMT-05:00
Contributor guide
Research direction
Start by running the provided JavaScript examples with Day.js v1.11.7 and the stated GMT-05:00 timezone, then inspect the date-formatting behavior involved. Add a regression test for both Date constructors and verify that formatting produces the expected day, month, and year.
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
- Mostly clear
- Newbie friendliness
- 38/100