Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The utcToZonedTime function adds an extra day if the timeZone parameter is "UTC" and the date is between "00:00:00.000Z" and "00:59:59.999Z" #53

Closed
adc-mhaugen opened this issue Feb 20, 2020 · 4 comments

Comments

@adc-mhaugen
Copy link

The utcToZonedTime function adds an extra day if the timeZone parameter is "UTC" and the time portion of the passed date value is between "00:00:00.000Z" and "00:59:59.999Z".

window.console.log(utcToZonedTime(new Date('2020-02-19T18:59:59.999-0500'), 'UTC')); // Wed Feb 19 2020 23:59:59 GMT-0500 (Eastern Standard Time)
window.console.log(utcToZonedTime(new Date('2020-02-19T19:00:00.000-0500'), 'UTC')); // Fri Feb 21 2020 00:00:00 GMT-0500 (Eastern Standard Time)
window.console.log(utcToZonedTime(new Date('2020-02-19T19:59:59.999-0500'), 'UTC')); // Fri Feb 21 2020 00:59:59 GMT-0500 (Eastern Standard Time)
window.console.log(utcToZonedTime(new Date('2020-02-19T20:00:00.000-0500'), 'UTC')); // Thu Feb 20 2020 01:00:00 GMT-0500 (Eastern Standard Time)

Using date-fns-tz@1.0.9.

@adc-mhaugen adc-mhaugen changed the title The utcToZonedTime function adds an extra day if the timeZone parameter is "UTC" and the date is between 0:00:00 and 0:59:59 UTC time The utcToZonedTime function adds an extra day if the timeZone parameter is "UTC" and the date is between "00:00:00.000Z" and "00:59:59.999Z" Feb 20, 2020
@adc-mhaugen
Copy link
Author

Looks like this issue may only happen in Chrome 80.

@yauheni-platau
Copy link

Had the same issue in chrome 80. Firefox and safari worked fine
Updating to version 1.0.10 solved this
This comment helped #38 (comment)

@shivkumarganesh
Copy link

shivkumarganesh commented Jul 10, 2020

We are experiencing the same issue. Is there a fix provided for the same? I see it does not work on chrome still even after I have updated the library to 1.0.10.

marnusw added a commit that referenced this issue Dec 21, 2021
@marnusw
Copy link
Owner

marnusw commented Dec 21, 2021

I've tested this with v1.2.2 and the latest Chrome and it seems to work fine now.

@marnusw marnusw closed this as completed Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants