iamkun / iamkun/dayjs

startOf('month') gives last day in previous month

Open
#2,007 8 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**

Start of month is incorrect and showing the last day in previous month.

```javascript
const from = dayjs.tz(dayjs(),'Europe/London').startOf('month')
const end = dayjs.tz(dayjs(),'Europe/London').endOf('month')
```

The above when console logged outputs:

> from: Thu, 30 Jun 2022 23:00:00 GMT
> to: Sun, 31 Jul 2022 22:59:59 GMT

Which I think we can all agree is incorrect

**Expected behavior**

[start of time](https://day.js.org/docs/en/manipulate/start-of) should always return correct times.

**Information**
- Day.js Version 1.11.3
- OS: Latest chrome on Mac OS
- Browser Chrome
- Time zone: Europe/London

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.