[dataview] Calendar view of all outgoing links that look like dates

What I’m trying to do

I’m trying to use dataview to create a calendar/itinerary from a note (I want simpler functionality/syntax than the obsidian-itinerary plugin)

So If my note has something like:

[[2023-12-05]] Leave for trip
[[2023-12-06]] Meet Bob
[[2023-12-07]] Return from trip

Then it’d be great to show all those dates on a calendar. The backlinks for each daily note would show me the ‘todo’ for that date.

Things I have tried

I’m running into a few complications:

LIST
FROM outgoing([[]])

doesn’t get all the pages I want, because some of them are in the future and thus uncreated.

But I seem to be able to get roughly what I want via:

LIST WITHOUT ID file.outlinks
WHERE file = this.file

Now I assumed I could do something like:

CALENDAR WITHOUT ID file.outlinks
WHERE file = this.file

But it makes sense that that doesn’t quite work.
SO I also tried something like:

LIST
FLATTEN map(file.outlinks, (x) => date(x.name))
WHERE file = this.file

to try to get a list of just the outlinks that look like dates. But this actually just returns n copies of links to this page

I’m floundering a bit.

OK. I made maybe a tiny bit of progress?

The following is able to filter out any outlinks that aren’t dates.

LIST without ID
filter(file.outlinks, (o) => date(o))
where this.file = file

However, I’m guessing the return type is still not right, because I can’t take that query and do:

CALENDAR without ID
filter(file.outlinks, (o) => date(o))
where this.file = file

That query still returns not single dates but lists of dates, so try something like the following:

```dataview
CALENDAR WITHOUT ID aDate
FLATTEN filter(file.outlinks, (o) => date(o) ) as aDate
WHERE this.file = file
```

Here the FLATTEN will cause the potential list of dates to become single entries. The same would apply if you opened up scanning multiple files. Each “row” in this query will be a single entry readily available for CALENDAR to display in calendar format.

It “works” if I change it to LIST; but it isn’t happy with CALENDAR

Ooppsie… try removing the “without id”… That shouldn’t be there…

So when I make it be LIST WITHOUT ID, I get several entries:

So I know that the query makes sense.

But as soon as I change it to CALENDAR, I just get a blank screen instead of a calendar. (Not adding a screenshot because it’s literally just blankness.)

So here are my first test query:

```dataview
LIST 
FROM "ForumStuff/f52"
WHERE weight
```

Which returns:
image

And when you do a CALENDAR query you need to specify where the date is, and with an output like the previous we could use file.day, so my second query then becomes:

```dataview
CALENDAR file.day 
FROM "ForumStuff/f52"
WHERE weight
```

And sure enough, when going back a year in the calendar it displays:

So maybe you’re just missing the addition of the variable holding the date?


I further added some links in my test files to the dates with an odd day, and used this query:

```dataview
LIST WITHOUT ID file.outlinks
WHERE file = this.file
```

This displays as:
image

Do you see that double dot at the first line indicating that this is a list of lists, where the outer list has only one element? This comes from the fact that this query limits the end result to just this.file. And this is then not viable for usage by calendar as is. And some further testing indicated that it do need to get a query result which is actually a date, and then it’ll link to the file matching the query (aka this.file )

Long story short, you’ll need to turn around your query, and look for linking to the current file, instead of the outlinks of the current file.

So here are two queries which worked for me:

```dataview
LIST
FROM outgoing([[]])
WHERE typeof(date(file.name)) = "date"
```

And the calendar version of this query:

```dataview
CALENDAR date(file.name)
FROM outgoing([[]])
WHERE typeof(date(file.name)) = "date"
```

This shows the calendar with my three test files, after I’ve navigated to the correct month of last year (in my test case).


In summary, you’ll need to get a LIST query working which list each of the file matching your criteria, and present a column from that file showing a date. When you’ve got that query, you can switch to the CALENDAR query with the display of that column.

This’ll present you with a calendar of those entries, but it’ll always show the current month, and you’ll need to navigate to the correct month for the little dot to appear. So my question back to you is: Isn’t it easier just to hover over the link itself, from the LIST query, instead of trying to present in a calendar view where you don’t get any hint as to how many entries you’ve got and in which month they display as that little dot?