iamkun / iamkun/dayjs

Incorrect behavior of `dayjs.tz`

Open
#2,720 1 comment 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48.7k
Forks
2.8k
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
```ts
const date = new Date() // utc timezone date
// 2024-09-04T10:04:12.774Z

dayjs.tz(date, "Asia/Kolkata").toISOString()
// 2024-09-04T10:04:12.774Z

dayjs.tz(date.toISOString(), "Asia/Kolkata").toISOString()
// 2024-09-04T04:34:12.774Z
```

**Expected behavior**
```ts
dayjs.tz(date, "Asia/Kolkata").toISOString()
// 2024-09-04T04:34:12.774Z
```

**Information**
- Day.js Version: v1.11.13
- OS: macOS
- Browser: Node.js
- Time zone: UTC

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the two dayjs.tz examples from the issue in Node.js with the timezone set to UTC, comparing Date and ISO string inputs for Asia/Kolkata. Trace the dayjs.tz entry point and timezone handling, then verify that both inputs produce the expected 2024-09-04T04:34:12.774Z result.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.