Dateview date(today) not filtering properly

What I’m trying to do

I’ve been trying to create a simple dataview query to view uncompleted tasks that are past due. The project files in my vault all have a custom frontmatter property “due-date” that’s a Date type. This is the query that I have currently:

TASK
FROM !"00-Templates"
WHERE file.frontmatter.due-date AND file.frontmatter.due-date >= date(today) AND !checked

I’m expecting this query to only return uncompleted tasks within files with the due-date property that has a value after today’s current date, but this query is returning ALL uncompleted tasks within these files. When I change date(today) to a string with today’s date in YYYY-MM-DD format (ex: “2024-08-30”) it returns the expected results. I’ve checked the output of date(today) and it returns today’s date in YYYY-MM-DD format. I’ve looked at dataview wiki page for examples on date(today) but I don’t understand why date(today) is causing issues in this query. Can anyone help?

Things I have tried

  • Changing the date format for dataview in settings > dataview > dateformat
    from “MMMM yy dd” to “yyyy-MM-dd”
  • changing due-date property type from Date type to String
  • changing due-date property name “due-date” to “duedate”

The note and query below work in local tests.

Are the due-date values you use written in YYYY-MM-DD format as in this example?

---
due-date: 2024-09-30
---

- [ ] This is a task 

## Query 1

```dataview
TASK
FROM !"00-Templates"
WHERE !checked
AND due-date 
AND due-date >= date(today)
SORT due-date ASC
```

Yes I’m using YYYY-MM-DD format. Your query works great, looks like it was the file.frontmatter.due-date syntax that was messing it up. Still not sure why the frontmatter syntax wasn’t working. From what I understand file.frontmatter.due-date targets the same property that due-date is. I’ll look into this more, thanks!

1 Like

If I remember correctly then file.frontmatter.duedate is the raw unformatted version. So no auto detection of a date format, which happens with due-date.

1 Like

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