iamkun / iamkun/dayjs

combine tz and startOf function will get the wrong result

Open
#2,290 1 comment 4 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**
截圖 2023-04-19 10 42 14

as you can see

given a specific time `2021-10-31T16:00:00.000Z`

execute `dayjs(time).tz('GMT').startOf('day').format('YYYY-MM-DD HH:mm:ssZ')`

the return value is `2021-10-30 16:00:00+00:00`, but I expect the value would be `2021-10-31 00:00:00+00:00`

and I check the timestamp (1635638400000), and format again

`dayjs(1635638400000).tz('GMT').format('YYYY-MM-DD HH:mm:ssZ')`

and I got the expect result

**Information**
I test at the dayjs document site console (https://day.js.org/docs/en/timezone/timezone)

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.