Skip to content

printing of POSIXct should (could?) include tz info if it's there #2842

Description

@MichaelChirico
DT = data.table(
  t1 = as.POSIXct('2018-05-01 12:34:56', tz = 'UTC'),
  t2 = as.POSIXct('2018-05-01 12:34:56', tz = 'Asia/Singapore')
)
DT
#                     t1                  t2
# 1: 2018-05-01 12:34:56 2018-05-01 12:34:56
DT$t1
# [1] "2018-05-01 12:34:56 UTC"
DT$t2
# [1] "2018-05-01 12:34:56 +08"

The printed output makes t1 and t2 seem identical, but they're not.

The same problem applies to data.frames, to be fair:

setDF(copy(DT))[]
#                    t1                  t2
# 1 2018-05-01 12:34:56 2018-05-01 12:34:56

Probably timezone printing should be on by default due to the above, but at least there should be an option.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions