Reputation: 11660
I cannot find any property receiving the currently for the user displayed calendar week with google apps-script here
What I want to do is: Extract the start and end date of the days displayed for the user in google-calendar.
What I already archive is to get events of the current week's Monday (so from the perspective of today):
getEventsOfThisWeek(calendarId) {
calendar = CalendarApp.getCalendarById(calendarId);
let referenceDay = new Date(); //here I would like to get a day from displayed week
let monday = this.getMondayMidnightAM(referenceDay);
let friday = theís.getFridayMidnightPM(referenceDay)
let events = calendar.getEvents(monday, friday );
return events
}
getMondayMidnightAM(ref) {
let day = ref.getDay();
let diff = ref.getDate() - day + (day == 0 ? -6 : 1); // adjust when day is sunday
ref.setDate(diff);
let mondayMidnight = new Date(ref.toISOString().replace(/T\S{8}/, "T00:00:00"));
return mondayMidnight;
}
So far I understood, that isSelected()
tells me not if the event is on screen in the current view, but rather if the display in all the calendar option is on.
Upvotes: 1
Views: 363
Reputation: 26836
In Short: It is not possible.
Upvotes: 1