From 27b5a7c95395fa9d5ea590b895327178b83e6847 Mon Sep 17 00:00:00 2001 From: Inna Date: Fri, 7 Nov 2025 13:40:18 +0300 Subject: [PATCH] =?UTF-8?q?fix=20[P-296]:=20=D1=84=D0=B8=D0=BA=D1=81=20?= =?UTF-8?q?=D1=84=D0=BE=D1=80=D0=BC=D1=8B=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D1=81=D0=BE=D0=B1=D1=8B=D1=82=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UI_calendar/CustomCalendar.vue | 17 +-- .../UI_calendar/periodEvents.vue | 45 ++++++-- .../UI_calendar/timeSelect.vue | 39 ++++--- .../composables/useReccurrence.js | 20 ++-- .../calendar_of_events/event-create.vue | 101 ++++++++++++------ 5 files changed, 146 insertions(+), 76 deletions(-) diff --git a/src/front/src/components/calendar_of_events/UI_calendar/CustomCalendar.vue b/src/front/src/components/calendar_of_events/UI_calendar/CustomCalendar.vue index 1b6a60ebf..9daaad79f 100755 --- a/src/front/src/components/calendar_of_events/UI_calendar/CustomCalendar.vue +++ b/src/front/src/components/calendar_of_events/UI_calendar/CustomCalendar.vue @@ -155,13 +155,13 @@ export default { initialView: props.forHomePage ? props.view : currentView.value, locales: [ruLocale], locale: 'ru', - timeZone: 'locale', + timeZone: 'Europe/Moscow', firstDay: 1, headerToolbar: false, height: '80vh', aspectRatio: 1.5, weekNumbers: true, - eventDisplay: 'block', + eventDisplay: 'auto', eventTimeFormat: { hour: '2-digit', minute: '2-digit', @@ -277,7 +277,7 @@ export default { title: instance.title, start: instance.start, end: instance.end, - allDay: instance.allday || isMultiDay, + allDay: instance.allDay, textColor: '#ffffff', backgroundColor: eventColor, borderColor: eventColor, @@ -287,21 +287,12 @@ export default { }, })); } else { - let end = event.date_end; - - if (event.allday) { - // Для allDay: просто добавляем 1 день к конечной дате - const endDate = new Date(event.date_end); - endDate.setDate(endDate.getDate() + 1); - end = endDate.toISOString(); - } - return [ { id: event.id, title: event.name, start: event.date_start, - end: end, + end: event.date_end, allDay: event.allday, textColor: '#ffffff', backgroundColor: eventColor, diff --git a/src/front/src/components/calendar_of_events/UI_calendar/periodEvents.vue b/src/front/src/components/calendar_of_events/UI_calendar/periodEvents.vue index a02160d27..d66bddd1e 100755 --- a/src/front/src/components/calendar_of_events/UI_calendar/periodEvents.vue +++ b/src/front/src/components/calendar_of_events/UI_calendar/periodEvents.vue @@ -13,31 +13,56 @@ import { computed } from 'vue'; export default { props: { - dateEventStart: { + dateEvent: { type: Object, default: () => {}, }, }, setup(props, { emit }) { + // const newDate = computed({ + // get() { + // return propsDateEvent.value.allday; + // }, + // set(newValue) { + // propsDateEvent.value.allday = newValue; + // if (newValue === true) + // (propsDateEvent.value.date_end = new Date( + // new Date(propsDateEvent.value.date_end).setHours(23, 59, 59), + // )) && + // (propsDateEvent.value.date_start = new Date( + // new Date(propsDateEvent.value.date_start).setHours(0, 0, 0), + // )); + // }, + // }); + const newDate = computed({ get() { return propsDateEvent.value.allday; }, set(newValue) { propsDateEvent.value.allday = newValue; - if (newValue === true) - (propsDateEvent.value.date_end = new Date( - new Date(propsDateEvent.value.date_end).setHours(23, 59, 59), - )) && - (propsDateEvent.value.date_start = new Date( - new Date(propsDateEvent.value.date_start).setHours(0, 0, 0), - )); + + const startDate = new Date(propsDateEvent.value.date_start); + const endDate = new Date(propsDateEvent.value.date_end); + + if (newValue === true) { + // Весь день: 00:00 - 23:59 + startDate.setHours(0, 0, 0, 0); + endDate.setHours(23, 59, 59, 999); + } else { + // Рабочие часы: 09:00 - 17:00 + startDate.setHours(9, 0, 0, 0); + endDate.setHours(17, 0, 0, 0); + } + + propsDateEvent.value.date_start = startDate.toISOString(); + propsDateEvent.value.date_end = endDate.toISOString(); }, }); const propsDateEvent = computed({ - get: () => props.dateEventStart, - set: (value) => emit('update:dateEventStart', value), + get: () => props.dateEvent, + set: (value) => emit('update:dateEvent', value), }); return { diff --git a/src/front/src/components/calendar_of_events/UI_calendar/timeSelect.vue b/src/front/src/components/calendar_of_events/UI_calendar/timeSelect.vue index 17a6560ed..6b35a3f80 100755 --- a/src/front/src/components/calendar_of_events/UI_calendar/timeSelect.vue +++ b/src/front/src/components/calendar_of_events/UI_calendar/timeSelect.vue @@ -1,5 +1,5 @@