Skip to content

coercing a datetime to a datetime loses timezone #1085

@mkoohafkan

Description

@mkoohafkan

a POSIX*t object's timezone is lost when it is coerced to a POSIX*t object using as_datetime():

x = as.POSIXct("2022-01-01 23:40:36", tz = "US/Pacific")
as_datetime(x)
## [1] "2022-01-02 07:40:36 UTC"
identical(x, as_datetime(x))
## [1] FALSE

# not the case with as.POSIXct
identical(x, as.POSIXct(x))
## [1] TRUE

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions