Skip to content
Discussion options

You must be logged in to vote

I wrote this in a reply, but I thought I'd put it out here as well. The answer was, of course, regex.

The following snippet will extract any tasks completed today and return them with the completion date stripped from the text field

var today = luxon.DateTime.now().toISODate()
var re = /\[completion::.*?\]/
var filter = "@PERSON"

var out = dv.pages().file.tasks.where(t => t.completion && t.text.includes(filter) && dv.equal(t.completion.toISODate(), today)).map(t => {t.text = t.text.replace(re, ""); return t})

dv.taskList(out)

Sadly this does break the ability to uncomplete the object from the the task list, which is something I don't know if I can fix.

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
7 replies
@HyperEpsilon
Comment options

@AB1908
Comment options

@HyperEpsilon
Comment options

@AB1908
Comment options

@HyperEpsilon
Comment options

Comment options

You must be logged in to vote
1 reply
@AB1908
Comment options

Answer selected by HyperEpsilon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants