Adding a month to a date removes an hour.
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Adding a month to a date removes an hour.
**Expected behavior**
```
const initialDate = dayjs('2022-02-28T00:00:00.000Z');
const oneMonthAdded = initialDate.add(1, 'month');
console.log(oneMonthAdded.toISOString());
```
Should output `2022-03-28T00:00:00.000Z`
**Actual behaviour**
Outputs `2022-03-27T23:00:00.000Z`
**Information**
- Day.js Version: 1.10.7
- OS: Win 10
- Browser: N/A
- Time zone: GMT+2
Contributor guide
Research direction
Run the provided Day.js reproduction in the reported GMT+2 environment and compare its output with the expected ISO timestamp. Trace the implementation reached by add(1, 'month') and its date/time-zone handling; the fix is done when the example preserves 00:00:00.000Z and relevant behavior is covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100