iamkun / iamkun/dayjs

Problem with timezones in react native

Open
#2,372 11 comments 5 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**
When I try convert date to select timezone, I got 'Invalid date'.
I know that we can use polyfill from this [thread](https://github.com/iamkun/dayjs/issues/1377) but it's look terrible.

```js
console.log(dayjs('2023-07-11T10:00:00').tz('Australia/Melbourne').format('YYYY-MM-DD HH:mm'));
console.log(dayjs('2023-07-11T10:00:00').tz('Australia/Melbourne').utc().format('YYYY-MM-DD HH:mm'));
```
got:
![image](https://github.com/iamkun/dayjs/assets/23406402/a9d4667d-e402-47f8-b9d4-a7e190e42243)

**Expected behavior**
Timezone is working on react-native

**Information**
- Day.js Version [1.11.7]
- OS: MacOS m1
- React-native [0.71.8]
- Time zone: [not important]

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.