Skip to content

Commit

Permalink
Make getRemoteEvents inclusive of the last day, by adding one to the …
Browse files Browse the repository at this point in the history
…`to` date. (#242)
  • Loading branch information
MelissaAutumn authored Jan 23, 2024
1 parent 8f5b75e commit 022675a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion frontend/src/views/CalendarView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,12 @@ const calendarEvents = ref([]);
const hideUntilRefreshed = ref(true);
const getRemoteEvents = async (from, to) => {
// Most calendar impl are non-inclusive of the last day, so just add one to the day.
const inclusiveTo = dj(to).add(1, 'day').format('YYYY-MM-DD');
calendarEvents.value = [];
await Promise.all(calendarStore.connectedCalendars.map(async (calendar) => {
const { data } = await call(`rmt/cal/${calendar.id}/${from}/${to}`).get().json();
const { data } = await call(`rmt/cal/${calendar.id}/${from}/${inclusiveTo}`).get().json();
if (Array.isArray(data.value)) {
calendarEvents.value.push(...data.value.map((e) => ({ ...e, duration: dj(e.end).diff(dj(e.start), 'minutes') })));
}
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/views/ScheduleView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,12 @@ const dateNav = (unit = 'auto', forward = true) => {
// get remote calendar data for current year
const calendarEvents = ref([]);
const getRemoteEvents = async (from, to) => {
// Most calendar impl are non-inclusive of the last day, so just add one to the day.
const inclusiveTo = dj(to).add(1, 'day').format('YYYY-MM-DD');
calendarEvents.value = [];
await Promise.all(calendarStore.connectedCalendars.map(async (calendar) => {
const { data } = await call(`rmt/cal/${calendar.id}/${from}/${to}`).get().json();
const { data } = await call(`rmt/cal/${calendar.id}/${from}/${inclusiveTo}`).get().json();
if (Array.isArray(data.value)) {
calendarEvents.value.push(...data.value.map((e) => ({ ...e, duration: dj(e.end).diff(dj(e.start), 'minutes') })));
}
Expand Down

0 comments on commit 022675a

Please sign in to comment.