iamkun / iamkun/dayjs

timezone doesn't work

Open
#2,415 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:
When applying the time zone: dayjs.tz(dayjs().utc(true).toISOString(), 'Asia/Dubai')
taking into account the time in Brazil, the right thing was to add +7 hours ahead, but the negative calculation occurs (-7) and it subtracts. The same happens with the New York ("America/New_York") time in relation to Brazil, instead of decreasing -1 hour, it is adding +1 hour in relation to Brazil.

Expected:
invert the library's timezone calculation from what it is today

Date and time of code print test:
Brazil: 15-08-2023 13:00

![Captura de Tela 2023-08-15 às 13 00 35](https://github.com/iamkun/dayjs/assets/38323883/181b6012-5df9-4009-9af4-9bea1d9619b7)
![Captura de Tela 2023-08-15 às 13 01 27](https://github.com/iamkun/dayjs/assets/38323883/2d0c6321-75ef-4a55-ae29-ea728d9020bf)

Information:
- "dayjs": "^1.11.7",
- "react-native": "0.71.2",
- Time zone: [e.g. GMT-03:00 DST (Pacific Daylight Time)]

Contributor guide

Open the contributing guide

Research direction

Start with the reported dayjs.tz(dayjs().utc(true).toISOString(), 'Asia/Dubai') entry point and reproduce the Brazil, Dubai, and New York offset cases. Compare the observed offsets with the expected relationships in the issue and verify that the corrected timezone behavior is covered by regression tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
localization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.