Skip to content

Commit

Permalink
fixes #13: show character representation of date/time instead of raw …
Browse files Browse the repository at this point in the history
…timestamp
  • Loading branch information
yihui committed Feb 11, 2015
1 parent 94254cb commit e6ee2fa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions R/datatables.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ datatable = function(
options$serverSide = TRUE
}

# rstudio/DT#13: convert date/time to character
if (isDF) for (j in seq_len(ncol(data))) {
if (inherits(data[, j], 'Date')) {
data[, j] = as.character(data[, j])
} else if (inherits(data[, j], c('POSIXlt', 'POSIXct'))) {
data[, j] = sub('(\\d{2})(\\d{2})$', '\\1:\\2', format(
data[, j], '%Y-%m-%dT%H:%M:%OS6%z'
))
}
}
data = escapeData(data, escape, colnames)
data = fixWAT(data)
# do not use is.list() because is.list(data frame) is TRUE
Expand Down

0 comments on commit e6ee2fa

Please sign in to comment.