obsidian-full-calendar icon indicating copy to clipboard operation
obsidian-full-calendar copied to clipboard

Access remote events from dataviewjs

Open renarl opened this issue 1 year ago • 3 comments

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?

renarl avatar Aug 18 '22 17:08 renarl

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

gala8y avatar Aug 25 '22 14:08 gala8y

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
)
```

renarl avatar Aug 28 '22 07:08 renarl

This is an interesting feature request, thanks @renarl!

davish avatar Oct 05 '22 18:10 davish

I second this! I am trying to get info about remote .ical events using dataviewjs. It would be amazing to have this functionality.

KosmosisDire avatar Jan 16 '23 08:01 KosmosisDire