Skip to contents

Format date with dayjs JavaScript library

Usage

format_date_dayjs(format, prefix = "", suffix = "", locale = "en")

format_datetime_dayjs(
  format,
  prefix = "",
  suffix = "",
  locale = "en",
  tz = NULL
)

label_format_date(format)

label_format_datetime(format, tz = NULL)

Arguments

format

Format for dates, see online documentation.

prefix

Character string to append before formatted value.

suffix

Character string to append after formatted value.

locale

Localization to use, for example "fr" for french, see possible values online.

tz

Timezone to use.

Value

a JS function.

Examples


library(vchartr)



### Format date

# date in french in %B %y format
vchart(eco2mix) %>%
  v_line(aes(date, solar)) %>%
  v_scale_x_date(
    date_labels = format_date_dayjs("MMMM YY", locale = "fr")
  )
# date in arabic in %A %d %b %Y format vchart(eco2mix) %>% v_line(aes(date, solar)) %>% v_scale_x_date( date_labels = format_date_dayjs("dddd D MMM YYYY", locale = "ar") )