iamkun / iamkun/dayjs

Timezone return Invalid Date using Node v19.1.0

Open
#2,153 1 comment 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**
Timezone plugin returns **invalid date** using node v19.1.0
I'm using tz() to convert and parse date

Exactly like these
- https://day.js.org/docs/en/timezone/parsing-in-zone
- https://day.js.org/docs/en/timezone/converting-to-zone

```typescript
const date = new Date('2022-02-10T06:00:00.000Z')
const date1 = dayjs(date).tz('America/Managua')
const date2 = dayjs.tz(date, 'America/Managua')
// date1 and date2 = { $d: Invalid Date, $D: NaN, $H: NaN, ...}
```

**Expected behavior**
` node v17.4.0`
```typescript
const date = new Date('2022-02-10T06:00:00.000Z')
const date1 = dayjs(date).tz('America/Managua')
const date2 = dayjs.tz(date, 'America/Managua')
//date1 and date2 = { $d: Thu Feb 10 2022 00:00:00 GMT+0000 (tiempo universal coordinado), $D: 10, $H: 0, ...}
```

**Information**
- Day.js Versions tested: ^1.10.7, ^1.11.6
- Node versions tested: v17.4.0, v19.1.0
- OS: iOS
- Browser: - (I'm using dayjs in backend)
- Time zones tested: GMT+01:00 (Europe/Madrid) and GTM+00:00

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.