iamkun / iamkun/dayjs

dayjs() returns wrong time on Android React Native

Open
#1,942 1 comment 1 reaction 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**
when I do
```
import dayjs from 'dayjs';
dayjs.tz.setDefault('America/New_York');
const datenow = dayjs();
```
I get something like "2022-06-13T21:00:00.000Z" which is incorrect time. the correct time is 06:03 PM. However, if I do
```
datenow().hour() -> 6
datenow().minute -> 3
```
this is correct. Please let me know how to get correct current time

**Expected behavior**
A clear and concise description of what you expected to happen.

**Information**
- Day.js Version [e.g. v1.0.0] 1.11.0
- OS: [e.g. iOS] Android (React Native)
- Browser [e.g. chrome 62]
- Time zone: [e.g. GMT-07:00 DST (Pacific Daylight Time)]. EST (New York)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported snippet with Day.js 1.11.0 on Android React Native, including the America/New_York default time zone, and compare the ISO output with the local hour and minute. Done means the current time representation is consistent with the expected New York time on the reported platform.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.