What I’m trying to do
I use the Daily note plugin with a template. Each daily note is automatically created with the date (YYY-MM-DD format) as a file name. I want to write a DataViewJS (or DataView) query that works with the file name string as a date and compares it to the creation date value of all the other files in the vault. How can I write code that works with these two different value types to return a table showing the name and creation date of all the files in the vault that were created on the same day and month found in the title of the parent note?
Things I have tried
I currently use the query below but it draws from the parent files creation date; not the file name. Without referencing the date reflected in the file name, I can’t create daily notes for future dates without botching the query results. This also wreaks havoc when I miss creating a daily note and go back and create one on a later date.
TABLE WITHOUT ID file.link AS "Note", file.cday AS "Date"
WHERE file.ctime.month = this.file.ctime.month AND file.ctime.day = this.file.ctime.day AND file.name !=(this.file.name)
SORT file.ctime.year DESC
I’ve tried modifying code from other posted topics but other than finding a DataViewJS query that works with dates in the file name DataviewJS get files matching same date as note’s title I’ve had no luck. In the thread @holroy mentioned:
Within dataviewjs you can’t use
this.file.name
, you need to do something likedv.current().file.name
.
However the original poster didn’t choose to use that in the final solution so I’m not sure how to work with the property using JavaScript.