Day Countdown in a Table

So, here is my ‘idea’

I’d like to make a table where I can events or birthdays in one column, and in the other have the days but count down each day.

Event Days until
Person Birthday Days left until
Upcoming Event Days left until
Another person birthday Days left until
| Event | Days until |
| ---- | --- |
| Person Birthday | Days left until |
| Upcoming Event | Days left until |
| Another person birthday | Days left until |

I’ve been dabbling with this:

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

but I can’t figure out how to make things work in the table.

```template
| Events | Days Left |
|----------|----------|
| Event A | {{daysTillDate(“2025-01-24”)}} |
| Event B | {{daysTillDate(“2025-01-28”)}} |
```

This worked for me. Is this what you were looking for?

1 Like

It is.

It didn’t cross my mind to toss it in a code box…

Thank you.

1 Like