Lets try to illustrate what’s happening in your query (besides the created
vs scheduled
emoji issue), so paste the following into a file of its own:
---
Tags: f61031
date: 2023-06-07
---
questionUrl:: http://forum.obsidian.md/t//61031
- [ ] No scheduled ➕ 2023-06-05
- [ ] Yesterday⏳ 2023-06-06
- [ ] Today⏳ 2023-06-07
- [ ] Tomorrow ⏳ 2023-06-08
- [x] Answer request ➕2023-06-09
```dataview
TABLE WITHOUT ID task.text, task.created, task.scheduled, task.scheduled < this.file.day
FLATTEN file.tasks as task
WHERE !completed
WHERE file = this.file
```
Here we define some tasks, and then build up a TABLE
query to display these tasks and details related to these tasks. This can be a very useful strategy when debugging (aka looking for errors) in our queries. The query displays the following:
Here we can see the emoji issue I mentioned, and the scheduled date, and more interesting in the last column we can see how dataview interprets the scheduled < this.file.day
statement. Notice how the first row is true
, since it’s considering the empty value of scheduled to be less than a date.
This is another way of indicating that no date isn’t as vital as given date, or that we’ll respect your scheduled date if you’ve set it, and if not we’ll assume it’s a normal task you want to see and execute at any given point in time.
To counter for this, and eliminate all tasks not having set a scheduled date, you can add the scheduled
another time just to verify it has a value. So in my context (aka you could add this to the note above) the query would then become:
```dataview
TASK
WHERE !completed
WHERE scheduled AND scheduled <= this.file.day
WHERE file = this.file
```
And we’ll get the output of:
So adapt your query by adding scheduled AND
in front of the date comparison, if and only if you require the scheduled date to be set.
Trivia question; Which of these are true (if any)?
now < today? `= date(now) < date(today) `
now = today? `= date(now) = date(today) `
now > today? `= date(now) > date(today) `
Spoiler: Open to see answer
date(now)
contains the time as well as the date, so it’s larger than date(today)
which only contains the date. This can be a vital difference if doing date comparison in a daily note and so on…
date(now): `= dateformat(date(now), "yyyy-MM-dd HH:mm:ss")`
date(today): `= dateformat(date(today), "yyyy-MM-dd HH:mm:ss")`