Browse Source

fix: missing time and date handling

pull/9831/head
DarkPhoenix2704 5 days ago
parent
commit
a6699c8411
  1. 4
      packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue
  2. 12
      packages/nc-gui/components/smartsheet/calendar/MonthView.vue

4
packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue

@ -109,6 +109,10 @@ const calculateNewDates = useMemoize(
endDate = startDate.clone().add(15, 'minutes') endDate = startDate.clone().add(15, 'minutes')
} }
if (endDate.diff(startDate, 'minute') === 60) {
endDate = startDate.clone().add(59, 'minutes')
}
// If the start date is before the opened date, we use the schedule start as the start date // If the start date is before the opened date, we use the schedule start as the start date
// This is to ensure the generated style of the record is not outside the bounds of the calendar // This is to ensure the generated style of the record is not outside the bounds of the calendar
if (startDate.isSameOrBefore(scheduleStart)) { if (startDate.isSameOrBefore(scheduleStart)) {

12
packages/nc-gui/components/smartsheet/calendar/MonthView.vue

@ -261,11 +261,15 @@ const recordsToDisplay = computed<{
}) })
} else if (startCol && endCol) { } else if (startCol && endCol) {
// Multi-day event logic // Multi-day event logic
const startDate = dayjs(record.row[startCol.title!]) let startDate = dayjs(record.row[startCol.title!])
const endDate = dayjs(record.row[endCol.title!]) const endDate = dayjs(record.row[endCol.title!])
let currentWeekStart = startDate.startOf('week') let currentWeekStart = startDate.startOf('week')
if (startDate.isBefore(currentWeekStart)) {
startDate = calendarData.value.weeks[0].days[0].date
}
const id = record.rowMeta.id ?? generateRandomNumber() const id = record.rowMeta.id ?? generateRandomNumber()
// Since the records can span multiple weeks, to display, we render multiple elements // Since the records can span multiple weeks, to display, we render multiple elements
// for each week the record spans. The id is used to identify the elements that belong to the same record // for each week the record spans. The id is used to identify the elements that belong to the same record
@ -286,6 +290,12 @@ const recordsToDisplay = computed<{
const recordStart = currentWeekStart.isBefore(startDate) ? startDate : currentWeekStart const recordStart = currentWeekStart.isBefore(startDate) ? startDate : currentWeekStart
const recordEnd = currentWeekEnd.isAfter(endDate) ? endDate : currentWeekEnd const recordEnd = currentWeekEnd.isAfter(endDate) ? endDate : currentWeekEnd
if (recordEnd.isBefore(calendarData.value.weeks[0].days[0].date)) {
currentWeekStart = currentWeekStart.add(1, 'week')
continue
}
const duration = recordEnd.diff(recordStart, 'day') + 1 const duration = recordEnd.diff(recordStart, 'day') + 1
const dateKey = recordStart.format('YYYY-MM-DD') const dateKey = recordStart.format('YYYY-MM-DD')

Loading…
Cancel
Save