daysInMonth() returns 1 for april through october when using timezone
Open
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
```ts
dayjs(new Date(2020, 3, 1)).tz().daysInMonth() // returns 30
dayjs(new Date(2020, 3, 1)).tz('America/New_York').daysInMonth() // returns 1
```
https://stackblitz.com/edit/typescript-tqxa8b?file=index.ts
**Information**
- dayjs 1.9.7
- windows
- chrome 87
Contributor guide
Research direction
Start by running the linked StackBlitz reproduction with Day.js 1.9.7 and compare the two daysInMonth() calls. Trace the timezone-related path used by daysInMonth(); done means the America/New_York call returns 30 for April 2020 while the non-timezone call remains correct.
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
- 35/100