Set datetime formatter
Usage
set_formatter_datetime(
widget,
columns,
input_format = "yyyy-MM-dd hh:ss:mm",
output_format = "yy/MM/dd",
invalid_placeholder = "(invalid datetime)",
timezone = NA,
hoz_align = "left"
)
Arguments
- widget
A
tabulator()
HTML widget.- columns
The names of the columns the formatter is applied to.
- input_format
(character): The datetime input format.
- output_format
(character): The datetime output format.
- invalid_placeholder
(character): The value to be displayed if an invalid datetime is provided.
- timezone
(character): The timezone of the datetime.
- hoz_align
(character): The horizontal alignment of the column.
Value
The updated tabulator()
HTML widget
Details
To use this formatter, you need to include
the luxon HTML dependency with tabulator(..., luxon = TRUE)
.
Examples
data <- data.frame(
Person = c("Franz", "Ferdinand"),
Birthday = c(
"2024-12-06 22:00:10",
"2023-06-07 14:12:45"
)
)
tabulator(data, luxon = TRUE) |>
set_formatter_datetime("Birthday", output_format = "dd.MM.yyyy")