Didn’t try @AutonomyGaps’ new code, but let me check in my vault. What version of Dataview are you using, and which version of Obsidian?
EDIT: RESULTS
I found that I got the same error as you, had to leave the note and reopen it a few times and wait some minutes until it worked. The error occurs when file.day
can’t be populated (because the file has no recognized date in the title, and no date: YYYY-MM-DD
frontmatter field).
I have this now, and it works (the file is also called 2021-05-23 Test DataviewJS AutonomyGaps
, to provide a date to file.day
):
# 2021-05-23 Test DataviewJS AutonomyGaps
file.day: `=this.file.day`
file.mday: `=this.file.mday`
file.cday `=this.file.cday`
```dataviewjs
// default dateformat in case it’s forgotten in front matter
var dateformat = "YYYY-MM-DD";
if (dv.current().dateformat) { dateformat = dv.current().dateformat; }
dv.table(["File", "Last Modified", "Date Created"],
dv.pages()
.where(p => p.file.mday.equals(dv.current().file.day) || p.file.cday.equals(dv.current().file.day))
.sort(p => p.file.mtime, 'asc')
.map(p => [
p.file.link,
moment(p.file.mtime.toString()).format(dateformat),
moment(p.file.ctime.toString()).format(dateformat),
])
);
```
(Note the last line ``` is faked for the forum—remove it if copying, and use real 3 backticks.)
Result: