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")
with_tzdoes not seem to work correctly forPOSIXltobjects. According to the documentationwith_tzis not supposed to change the actual moment of time being represented. However, forPOSIXltobjects it appears to be changing only the time zone.I believe
with_tzwas working correctly forPOSIXltobjects inlubridateversion 1.6.0.I would expect the following two
with_tzcalls to return the same moment in time, but they do not. When I run this code usinglubridateversion 1.7.8 there is a difference of 5 hours according todifftime.