diff --git a/packages/nc-gui/composables/useCalendarViewStore.ts b/packages/nc-gui/composables/useCalendarViewStore.ts index 7a3046a6a5..9e1b454f68 100644 --- a/packages/nc-gui/composables/useCalendarViewStore.ts +++ b/packages/nc-gui/composables/useCalendarViewStore.ts @@ -202,8 +202,8 @@ const [useProvideCalendarViewStore, useCalendarViewStore] = useInjectionState( nextDate = selectedDate.value.add(1, 'day').startOf('day') break case 'selectedHours': - fromDate = selectedTime.value?.startOf('hour') - toDate = selectedTime.value?.endOf('hour') + fromDate = (selectedTime.value ?? dayjs()).startOf('hour') + toDate = (selectedTime.value ?? dayjs()).endOf('hour') prevDate = fromDate?.subtract(1, 'hour').endOf('hour') nextDate = toDate?.add(1, 'hour').startOf('hour') break diff --git a/tests/playwright/tests/db/views/viewCalendar.spec.ts b/tests/playwright/tests/db/views/viewCalendar.spec.ts index 4608d81445..ef2225446d 100644 --- a/tests/playwright/tests/db/views/viewCalendar.spec.ts +++ b/tests/playwright/tests/db/views/viewCalendar.spec.ts @@ -298,6 +298,7 @@ test.describe('View', () => { await calendar.calendarMonth.dragAndDrop({ record: 'Team Catchup', + to: { columnIndex: 3, rowIndex: 0, @@ -324,13 +325,13 @@ test.describe('View', () => { record: 'Team Catchup', to: { dayIndex: 0, - hourIndex: 10, + hourIndex: 5, }, }); await calendar.sideMenu.updateFilter({ filter: 'In selected hours' }); - await calendar.calendarWeekDateTime.selectHour({ dayIndex: 0, hourIndex: 10 }); + await calendar.calendarWeekDateTime.selectHour({ dayIndex: 0, hourIndex: 5 }); await calendar.sideMenu.verifySideBarRecords({ records: ['Team Catchup'] }); @@ -340,10 +341,10 @@ test.describe('View', () => { await calendar.calendarDayDateTime.dragAndDrop({ record: 'Team Catchup', - hourIndex: 5, + hourIndex: 3, }); - await calendar.calendarDayDateTime.selectHour({ hourIndex: 5 }); + await calendar.calendarDayDateTime.selectHour({ hourIndex: 3 }); await calendar.sideMenu.updateFilter({ filter: 'In selected hours' });