Replies: 1 comment 12 replies
-
In Quarto, we do our best to separate the date value and the formatting of the date. So, the best way to approach this, I think, is to specify a date and date-format separately. For example, to display only the year, you could write something like: ---
title: Quarto Document
author: Norah Jones
date: 2022-10-13
date-format: YYYY
---
## Test
Lorem ipsum. There are a few useful date macros that are treated specially ( More about specifying dates and date formats here: https://quarto.org/docs/reference/dates.html HTH! |
Beta Was this translation helpful? Give feedback.
12 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm finding problems when converting old documents from Rmd to qmd, in that I tend to use custom formats for the date, such as:
date: "`r format(Sys.time(), '%d %B, %Y')`"
date: "\\the\\year, Trimester 1"
date: 2023
date: !expr "`r format(Sys.time(), "%d %B, %Y")`"
(or something like that, I can never remember/find the right syntax)etc.
Quarto seems to perform some strict checks and either refuses to compile the document or, potentially worse, interprets the date as Y/M/D.
Most of the time I just end up changing
date:
with a custom variable such astaught: Trimester 1
and use the corresponding variable in the custom pandoc template, but if I was using a default template that workaround would not be possible. Is there a way to relax the checks for yaml entries? Or some flexible formatting options I might have overlooked? (common use-cases as shown above include specifying the year only, with a custom string attached, etc.)Beta Was this translation helpful? Give feedback.
All reactions