I want to always get either today's date (assuming today is a friday) or the next week's friday. How would I go about implementing the same mechanic in Typst? Within the documentation I have not yet found a way to perform "date-math" like shown above.
In Python I could do something like this:
report_date = date.today() + timedelta((5 - date.today().isoweekday()) % 7)
In Typst I can (seemingly) only elegantly cover the "today is friday" branch:
#let report_date = if datetime.today().weekday() == 5 {
datetime.today().display("[month repr:long] [day] [year]")
} else {
... # TODO
}
See the
Duration
type for performing date arithmetic: Duration Type. You can more or less 1:1 translate your Python snippet like this: