Skip to content

Commit efdd6d7

Browse files
Trying to get POSIXlt to print
1 parent c6781bd commit efdd6d7

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ S3method(edit, data.table)
199199
export(format_col)
200200
S3method(format_col, default)
201201
S3method(format_col, POSIXct)
202+
S3method(format_col, POSIXlt)
202203
S3method(format_col, expression)
203204
export(format_list_item)
204205
S3method(format_list_item, default)

R/print.data.table.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ print.data.table = function(x, topn=getOption("datatable.print.topn"),
149149

150150
format.data.table = function(x, ..., justify="none") {
151151
if (is.atomic(x) && !is.null(x)) { ## future R can use if (is.atomic(x))
152-
153152
stopf("Internal structure doesn't seem to be a list. Possibly corrupt data.table.")
154153
}
155154
do.call(cbind, lapply(x, format_col, ..., justify=justify))
@@ -214,6 +213,11 @@ format_col.POSIXct = function(x, ..., timezone=FALSE) {
214213
x
215214
}
216215

216+
format_col.POSIXlt = function(x, ...) {
217+
names(x) = names(unclass(as.POSIXlt(Sys.time())))
218+
format_col(as.POSIXct(x), ...)
219+
}
220+
217221
# #3011 -- expression columns can wrap to newlines which breaks printing
218222
format_col.expression = function(x, ...) format(char.trunc(as.character(x)), ...)
219223

0 commit comments

Comments
 (0)