Skip to content

with_tz is not working correctly for POSIXlt objects #886

@btvedt-liquidnet

Description

@btvedt-liquidnet

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")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions