Action

Calendar

Posted by Maxim Syomochkin, Last update 26 days ago

UPDATES

26 days ago

add tag affter create draft

A simple script that forms an agenda for daily notes in Obsidian.
https://mak-sim.ru/

Steps

  • script

    var start = new Date();
    start.setHours(0,0,0,0);
    
    var end = new Date();
    end.setHours(23,59,59,999);
    
    draft.insert("## Events " + start.toLocaleDateString(), 0);
    
    let cals = Calendar.getAllCalendars();
    for (var n = 0; n < cals.length; n++) {
    	let events = cals[n].events(start,end);
    	for (var i = 0; i < events.length; i++) {
    		let event = events[i];
    		draft.append("### " + event.title);
    		draft.append("> [!INFO]+ INFO");
    		draft.append("> **Start**: " + event.startDate.toLocaleTimeString());
    		draft.append("> **Attendees**: " + event.attendees.filter(u => !u.isCurrentUser).map(u => "[[people/" + u.name + "]]").join(", ") + "\n");
    	}
    }
    draft.update();

Options

  • After Success Nothing , Tags: calendar
    Notification Error
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.