obsidian-full-calendar
obsidian-full-calendar copied to clipboard
Access remote events from dataviewjs
I see an example of how to call calendar view from dataviewjs. Is there also a way to get a list of event data from dataviewjs so that I can show them in a table?
Hi, this little snippet shows table with events for any given day. Current file (where you put this code into) has to have a date in file name (for example, it can be your daily note).
table startTime as "start @", endTime as "end @", date(dateformat(file.day, "yyyy-MM-dd") + "T" + endTime) - date(dateformat(file.day, "yyyy-MM-dd") + "T" + startTime) as duration
from "folder name where your events are"
where file.day = this.file.day
sort startTime asc
Thanks for the suggestion. It works partially - I can get the local events I've created. But my primary need is to get remote events from iCloud and Google calendars so I can optionally make local event notes for some of them.
PS here is a dataviewjs
analog for getting local events if someone needs it:
```dataviewjs
// !! assuming that your file name is a date
const currFileName = dv.current().file.name;
const currentDay = luxon.DateTime.fromISO(currFileName);
// !! change this to the folder name where you revents are
const eventsFolderPath = "folder name where your events are";
const pagesThatRefferToToday = dv.pages(`"${eventsFolderPath}"`)
.where(p => (
p.date.equals(currentDay)
))
.flatMap(p => [
dv.fileLink(`${eventsFolderPath}/${p.file.name}`, false, `${p.title} - ${p.startTime} to ${p.endTime}`)
]);
dv.list(
pagesThatRefferToToday
)
```
This is an interesting feature request, thanks @renarl!
I second this! I am trying to get info about remote .ical events using dataviewjs. It would be amazing to have this functionality.