Date dynamic countdown

Is there a way to add a dynamic date (refreshes every day) that represents the days left from a set deadline, like 4 days left or 4d ? which plugin should i use for this ?

1 Like

Yes, it’s possible. The way depends on what you want specifically. Tasks? Projects deadlines? etc. For each one you need add the data annotation (via yaml frontmatter or inline fields) in particular way and then create a query for that specific data.
Dataview plugin can do that (works with tasks or file data).
One example with queries to files (“projects”) and tasks:

Project 1

---
deadline: 2021-11-10
---

# Project 1


## Tasks

- [ ] Task one [due:: 2021-11-05]
- [ ] Task two [due:: 2021-11-14]
- [ ] Task three [due:: 2021-11-08]
- [ ] Task four đź“… 2021-12-01
- [ ] Task five đź“… 2021-11-30

Project 2

---
deadline: 2021-11-08
---

# Project 2

## tasks for next 7 days

```dataview
TASK
FROM "Teste4/Teste7"
WHERE (due - date(today)) <= dur(7 days)
```

## overdue tasks

```dataview
TASK
FROM "Teste4/Teste7"
WHERE due <= date(today)
```

Project 3

---
deadline: 2021-11-05
---

# Project 3

## projects deadline

```dataview
TABLE deadline - date(today) AS Countdown
FROM "Teste4/Teste7"
WHERE deadline >= date(today)
```

## overdue projects

```dataview
TABLE deadline - date(today) AS Delay
FROM "Teste4/Teste7"
WHERE deadline <= date(today)
```

## inline query

**`=[[Project 2]].deadline - date(today)`** left to finish [[Project 3]]
We have more time for [[Project 1]]: `=[[Project 1]].deadline - date(today)`

Results of tasks queries in Project 2

image

Results of projects queries in Project 3

image

(“Teste4/Teste7” is the folder where this notes are placed in my vault)

6 Likes

I’m more and more amazed by the power of dataview… thank you for your precious examples, @mnvwvnm !!!

[vaguely OT mode ON] And as I see what Dataview can do, I’m still wandering why it’s not (yet?) implemented in Obsidian Publish… [vaguely OT mode OFF]

3 Likes

The inline query specifically is super helpful to me, thank you.

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.