Browse Source

fix(nc-gui): issue with generating 45 minutes

pull/7731/head
DarkPhoenix2704 7 months ago
parent
commit
b9ef5a0944
  1. 2
      packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue
  2. 2
      packages/nc-gui/components/smartsheet/calendar/WeekView/DateTimeField.vue
  3. 1
      packages/nc-gui/composables/useViewColumns.ts

2
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 // We calculate the hour based on the percentage of the mouse position in the scroll container
// It can be between 0 and 23 (inclusive) // It can be between 0 and 23 (inclusive)
const hour = Math.max(Math.floor(percentY * 23), 0) 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 // 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') const newStartDate = dayjs(selectedDate.value).startOf('day').add(hour, 'hour').add(minutes, 'minute')

2
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 day = Math.max(0, Math.min(6, Math.floor(percentX * 7)))
const hour = Math.max(0, Math.min(23, Math.floor(percentY * 24))) 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') const newStartDate = dayjs(selectedDateRange.value.start).add(day, 'day').add(hour, 'hour').add(minutes, 'minute')
if (!newStartDate) return { newRow: null, updatedProperty: [] } if (!newStartDate) return { newRow: null, updatedProperty: [] }

1
packages/nc-gui/composables/useViewColumns.ts

@ -160,7 +160,6 @@ const [useProvideViewColumns, useViewColumns] = useInjectionState(
} }
const saveOrUpdate = async (field: any, index: number, disableDataReload: boolean = false) => { const saveOrUpdate = async (field: any, index: number, disableDataReload: boolean = false) => {
console.log('saveOrUpdate', field, index, disableDataReload)
if (isLocalMode.value && fields.value) { if (isLocalMode.value && fields.value) {
fields.value[index] = field fields.value[index] = field
meta.value!.columns = meta.value!.columns?.map((column: ColumnType) => { meta.value!.columns = meta.value!.columns?.map((column: ColumnType) => {

Loading…
Cancel
Save