Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 413 Bytes

DaysTillDate.md

File metadata and controls

18 lines (13 loc) · 413 Bytes

Days till date

This will add a template function that calculates the number of days from today until a given date.

silverbullet.registerFunction("daysTillDate",(date) => {
  const parsedDate = Temporal.PlainDate.from(date)
  const now = Temporal.Now.plainDateISO();
  return now.until(parsedDate, { largestUnit: 'days' }).days
})

Example

{{daysTillDate(nextWeek())}}