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

Render main calendar in-line with a note with Dataview

Open pcause opened this issue 2 years ago • 7 comments

The dataview example you gave gets the items passed to renderCalendar, but I'd like to be able to get access to / display the calendar that I've set up in a "container" so I can embed in a note. Can you give an example of how to do this and possibly customize the display (start in day/week view, get a specific week, etc)

pcause avatar Mar 31 '22 14:03 pcause

I was looking at this as well -- I really want to be able to specify the view for "today's events" in my daily note and connect them to todo's etc. From my reading of the code, it looks like there are some functions in https://github.com/davish/obsidian-full-calendar/blob/main/src/view.ts in CalendarView that would be useful to have pulled out so they can be overridden, or used elsewhere, since the main CalendarView handles a bunch of the work that renderCalendar would need (including getting the local events). It looks like one might need to override the ability to specify calendarEl to get it in place, and maybe pull some of the event handlers out, along with the calendarSources (which is exposed in settings).

@davish is this something you've been thinking about? Would a pull request toward this be helpful, or just get in the way?

matthewturk avatar Apr 04 '22 14:04 matthewturk

This is a great feature request! And it won't be that hard, as @matthewturk mentioned. @matthewturk If you want to take a stab at this, please go ahead!

davish avatar Apr 05 '22 22:04 davish

I was looking at this as well -- I really want to be able to specify the view for "today's events" in my daily note and connect them to todo's etc. From my reading of the code, it looks like there are some functions in https://github.com/davish/obsidian-full-calendar/blob/main/src/view.ts in CalendarView that would be useful to have pulled out so they can be overridden, or used elsewhere, since the main CalendarView handles a bunch of the work that renderCalendar would need (including getting the local events). It looks like one might need to override the ability to specify calendarEl to get it in place, and maybe pull some of the event handlers out, along with the calendarSources (which is exposed in settings).

@davish is this something you've been thinking about? Would a pull request toward this be helpful, or just get in the way?

I came here to suggest the 'todays events' feature as well!! This would be truly fantastic

wychwitch avatar Apr 15 '22 13:04 wychwitch

I came across this issue by chance, but this is something I have managed to implement by myself with the plug-in as it is. Here you can see the code that I have in my daily notes template:

this.container.style.minHeight = "1000px";
const { renderCalendar } = app.plugins.plugins["obsidian-full-calendar"];
let rawData = await dv.pages('"local_calendar"').where(p => p.date = dv.date("{{date:YYYY-MM-DD}}"));
let entries = rawData.map((p) => ({
    allDay: p.allDay,
    start: DateTime.fromISO(p.startTime).toJSDate(),
    end: DateTime.fromISO(p.endTime).toJSDate(),
    title: p.title,
    id: p.path
}));
let isMobile = window.innerWidth < 500;
let calendar = renderCalendar(this.container, [entries.array()]);
calendar.render();

See that '"local_calendar"' is the folder where your local calendar should be stored. The pv.pages() pulls a list of all notes in that folder, which are event notes. The .where argument filters by day, and here the baseline template plugin functionality comes into place. Then it is just a matter of parsing the information that's already available in the metadata of the notes as an event for the dataview integration to parse. In this way I see in my daily note my daily schedule without distractions.

I took inspiration from here: https://forum.obsidian.md/t/custom-full-calendar-with-dataview/34133

I hope this is indeed what the discussion was about and I didn't misunderstand the petition.

Let me know what you think :)

agustinfaure avatar May 04 '22 14:05 agustinfaure

thanks and it is great, but i have multiple calendars including ics links (Google/MS365 calendars). but this is of great help.

pcause avatar May 04 '22 17:05 pcause

I was looking at this as well -- I really want to be able to specify the view for "today's events" in my daily note and connect them to todo's etc. From my reading of the code, it looks like there are some functions in https://github.com/davish/obsidian-full-calendar/blob/main/src/view.ts in CalendarView that would be useful to have pulled out so they can be overridden, or used elsewhere, since the main CalendarView handles a bunch of the work that renderCalendar would need (including getting the local events). It looks like one might need to override the ability to specify calendarEl to get it in place, and maybe pull some of the event handlers out, along with the calendarSources (which is exposed in settings). @davish is this something you've been thinking about? Would a pull request toward this be helpful, or just get in the way?

I came here to suggest the 'todays events' feature as well!! This would be truly fantastic

I want to further say this would be great! Adding the functionality of today's events to my daily note would make this perfect!

molliehwhite avatar May 18 '22 19:05 molliehwhite

For anyone interested, there's a Dataview integration session in the doc. This dataview integration is utterly amazing! I switched from Day Planner to this plugin because I really like the weekly and monthly overview.

However, one big problem for me is that it's dataviewjs, meaning that I can't create or edit any events from within other notes. Currently I need to open another pane just for Full Calendar. It'd be amazing if it's a "real and native" embedding of Full Calendar, that is, allowing creating and editing entries from within other pages (like daily note). For example, Obsidian Tasks allows checking and unchecking tasks instead of just displaying a list of tasks.

No hurries however! Two-pane view makes me even more mindful and conscious about how the day goes by. Thank you again for such an amazing plugin!

kohane27 avatar May 24 '22 03:05 kohane27