Filtering Tasks by start date in DataviewJS

Problem

I am trying to view only tasks that are past their start date.

This is my current approach:


var pages = dv.pages('"tasks"').concat(dv.pages('"inbox"'))

dv.taskList(pages.file.tasks 
  .where(t => !t.completed)
  .where(t => (t.start <= this.date))
  )

I tried to find reference documentation for dataviewjs but the official one did not provide the info i need for this.

Background

My understanding is, that pages.file.tasks returns a list of Task objects, but I could not find a list of attributes provided by this class. Am I doing the comparison correctly or do is there a special comparison method for date objects? (This is my first time trying to write javascript)

How and where are you tasks defined? How do you define the start dates?

That’s a good starting point, besides even trying to tackle the query you’ve written.

Bonus tip: In forum posts enclose the markdown examples and code blocks with four backticks, ````, to make a nicer presentation of both the markdown and code blocks

The tasks are defined in various notes in a folder called “tasks” and another one called “inbox” like this: - [ ] Do someting🛫 2023-01-21
I’m using the Tasks plugin to create them. AFAIK, dataview should be compatible with Tasks?

In case anyone finds this questions later, this is the query that works for me:


var pages = dv.pages('"tasks"')

var today = dv.date("today")

dv.taskList(pages.file.tasks 
  .where(t => !t.completed)
  // .where(t => t.text.includes("2023-01-29"))
  .where(t => t.text.includes("#today"))
  .where(t => (t.start <= today || !t.start))
  )

Yes and no. They’re both native tasks, but the auto completion from a Dataview tasklist, might not fully work with Tasks tasks. Especially, if we’re talking about recurring tasks. I don’t think they’ll be adjusted.

There might be other anomalies, but in general they should work together, but there might be some specificities which differ.

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