From b9ef5a0944e2878d01034e02148b5a5e647e8cb1 Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Wed, 28 Feb 2024 10:11:39 +0000 Subject: [PATCH] fix(nc-gui): issue with generating 45 minutes --- .../components/smartsheet/calendar/DayView/DateTimeField.vue | 2 +- .../components/smartsheet/calendar/WeekView/DateTimeField.vue | 2 +- packages/nc-gui/composables/useViewColumns.ts | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue b/packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue index 16668fb226..b56d3db627 100644 --- a/packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue +++ b/packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue @@ -336,7 +336,7 @@ const calculateNewRow = (event: MouseEvent) => { // We calculate the hour based on the percentage of the mouse position in the scroll container // It can be between 0 and 23 (inclusive) const hour = Math.max(Math.floor(percentY * 23), 0) - const minutes = Math.max(0, Math.min(59, Math.floor(((percentY * 22 - hour) * 60) / 15) * 15)) + const minutes = Math.max(0, Math.min(59, Math.floor(((percentY * 22 - hour) * 60) / 15 + 0.5) * 15)) // We calculate the new startDate by adding the hour to the start of the selected date const newStartDate = dayjs(selectedDate.value).startOf('day').add(hour, 'hour').add(minutes, 'minute') diff --git a/packages/nc-gui/components/smartsheet/calendar/WeekView/DateTimeField.vue b/packages/nc-gui/components/smartsheet/calendar/WeekView/DateTimeField.vue index dc92bedf0f..19130bc362 100644 --- a/packages/nc-gui/components/smartsheet/calendar/WeekView/DateTimeField.vue +++ b/packages/nc-gui/components/smartsheet/calendar/WeekView/DateTimeField.vue @@ -528,7 +528,7 @@ const calculateNewRow = ( const day = Math.max(0, Math.min(6, Math.floor(percentX * 7))) const hour = Math.max(0, Math.min(23, Math.floor(percentY * 24))) - const minutes = Math.max(0, Math.min(59, Math.floor(((percentY * 22 - hour) * 60) / 15) * 15)) + const minutes = Math.max(0, Math.min(59, Math.floor(((percentY * 22 - hour) * 60) / 15 + 0.5) * 15)) const newStartDate = dayjs(selectedDateRange.value.start).add(day, 'day').add(hour, 'hour').add(minutes, 'minute') if (!newStartDate) return { newRow: null, updatedProperty: [] } diff --git a/packages/nc-gui/composables/useViewColumns.ts b/packages/nc-gui/composables/useViewColumns.ts index e74ccc731d..c0ed8a0058 100644 --- a/packages/nc-gui/composables/useViewColumns.ts +++ b/packages/nc-gui/composables/useViewColumns.ts @@ -160,7 +160,6 @@ const [useProvideViewColumns, useViewColumns] = useInjectionState( } const saveOrUpdate = async (field: any, index: number, disableDataReload: boolean = false) => { - console.log('saveOrUpdate', field, index, disableDataReload) if (isLocalMode.value && fields.value) { fields.value[index] = field meta.value!.columns = meta.value!.columns?.map((column: ColumnType) => {