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

with_tz is not working correctly for POSIXlt objects #886

Closed
btvedt-liquidnet opened this issue Apr 24, 2020 · 2 comments
Closed

with_tz is not working correctly for POSIXlt objects #886

btvedt-liquidnet opened this issue Apr 24, 2020 · 2 comments

Comments

@btvedt-liquidnet
Copy link

@btvedt-liquidnet btvedt-liquidnet commented Apr 24, 2020

with_tz does not seem to work correctly for POSIXlt objects. According to the documentation with_tz is not supposed to change the actual moment of time being represented. However, for POSIXlt objects it appears to be changing only the time zone.

I believe with_tz was working correctly for POSIXlt objects in lubridate version 1.6.0.

I would expect the following two with_tz calls to return the same moment in time, but they do not. When I run this code usinglubridate version 1.7.8 there is a difference of 5 hours according to difftime.

x <- strptime("2020-04-01 12:34:56", "%Y-%m-%d %H:%M:%OS", tz="UTC")
with_tz(x, "America/New_York")
with_tz(as.POSIXct(x), "America/New_York")
@personlin
Copy link

@personlin personlin commented Apr 30, 2020

I encounter the same issue!
version 1.7.4 was working correctly.

@vspinu
Copy link
Member

@vspinu vspinu commented Apr 30, 2020

This is actually a bug in R itself. Setting tzone attribute on posixlt objects results in a mess :/.

After recent simplification this re-emerged.

@vspinu vspinu closed this in dc104b6 Apr 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.