Data Column Formatter

Description

Data Column Formatter

Usage

format_date(
  data,
  start = "start",
  end = NULL,
  sep = " - ",
  date_format = "%b %Y",
  colname_date = "date",
  replace_na = "Present",
  sort_by = "none",
  decreasing = TRUE
)

Arguments

data Data frame for resume entry
start Start date column name. Default is "start"
end Optional. End date column name.
sep Separator between start and end date. Default is " - "
date_format Date format. Default is "%B %Y"
colname_date Name for the generated date column. Default is "date"
replace_na Value to replace NA values. Default is "Present"
sort_by Sort by "none", "start" or "end". Default is "none"
decreasing Sort in decreasing order. Default is TRUE

Value

Data frame with formatted date column

Examples

library("typstcv")

work <- data.frame(
  title = c("Technical Assistant", "Junior Professor", "Associate Professor"),
  location = c("Bern, Switzerland", "Bern, Switzerland", "Zürich, Switzerland"),
  start = as.Date(c("1902-01-01", "1908-01-01", "1909-01-01")),
  end = as.Date(c("1908-01-01", "1909-01-01", "1911-01-01")),
  description = c("Federal Patent Office", "University of Bern", "University of Zürich")
)

work |>
  format_date(end = "end", date_format = "%Y", sort_by = "start") |>
  resume_entry()
```{=typst}
#resume-entry(title: [Associate Professor],location: [Zürich, Switzerland],date: [1909 - 1911],description: [University of Zürich],)
#resume-entry(title: [Junior Professor],location: [Bern, Switzerland],date: [1908 - 1909],description: [University of Bern],)
#resume-entry(title: [Technical Assistant],location: [Bern, Switzerland],date: [1902 - 1908],description: [Federal Patent Office],)
```