.startOf('day') subtracts a full day if a startOf('day') date is parsed with timezone
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
I am using .startOf('day') to make sure a given date is the beginning of the given day
If im parsing a date which already is at the start of the day like 2025-11-07T23:00:00.000Z at timezone Europe/Berlin and use .startOf('day') on this date it returns 2025-11-06T23:00:00.000Z
if u run startOf('day') again u will go to 2025-11-05T23:00:00.000Z
Snippet:
`dayjs(new Date('2025-11-07T23:00:00.000Z')).tz('Europe/Berlin', true).startOf('day');`
**Expected behavior**
Since the given date already marks the start of a day, we should keep it and not go back 24hours
**Information**
- Day.js Version "^1.11.19"
Contributor guide
Research direction
Start by running the provided Day.js snippet with the Europe/Berlin timezone and inspect the startOf('day') and timezone entry points. Add a regression test for the reported timestamp, then verify that repeated startOf('day') calls preserve the intended calendar day instead of subtracting 24 hours.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100