Skip to content

Commit 731a770

Browse files
committed
fix logic for calendar
1 parent 38013a0 commit 731a770

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/widgets/calendar/event-form-dialog.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
: dayjs(`${startDate} ${startTime}`).toDate()
101101
102102
const dtend = isAllDay
103-
? dayjs(endDate).endOf('day').toDate()
103+
? dayjs(endDate).startOf('day').toDate()
104104
: dayjs(`${endDate} ${endTime}`).toDate()
105105
106106
if (event) {

src/widgets/calendar/utils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export const moveEvent = (event: CalendarEvent, newStartDate: Date): CalendarEve
165165
const daysDuration = endDate.diff(startDate, 'day')
166166

167167
newStart = newStart.startOf('day')
168-
newEnd = newStart.add(daysDuration, 'day').endOf('day')
168+
newEnd = newStart.add(daysDuration, 'day')
169169
} else {
170170
const duration = dayjs(event.dtend).diff(dayjs(event.dtstart))
171171
newStart = newStart.hour(dayjs(event.dtstart).hour()).minute(dayjs(event.dtstart).minute())
@@ -203,10 +203,10 @@ export const resizeEvent = (
203203
} else {
204204
let newEnd = originalEnd.add(dayOffset, 'day')
205205
if (event.isAllDay) {
206-
newEnd = newEnd.startOf('day').endOf('day')
206+
newEnd = newEnd.startOf('day')
207207
const originalStartDay = originalStart.startOf('day')
208-
if (newEnd.startOf('day').isBefore(originalStartDay)) {
209-
newEnd = originalStartDay.endOf('day')
208+
if (newEnd.isBefore(originalStartDay)) {
209+
newEnd = originalStartDay
210210
}
211211
} else {
212212
newEnd = newEnd.hour(originalEnd.hour()).minute(originalEnd.minute())

0 commit comments

Comments
 (0)