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 100644
--- 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 100644
--- 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/composables/useReccurrence.js b/src/front/src/components/calendar_of_events/composables/useReccurrence.js
index 7d37ff134..2b1c45484 100644
--- a/src/front/src/components/calendar_of_events/composables/useReccurrence.js
+++ b/src/front/src/components/calendar_of_events/composables/useReccurrence.js
@@ -8,9 +8,18 @@ export function useRecurrence() {
// Пробуем распарсить как RRULE-строку
if (periodString.includes('RRULE:')) {
const rrule = RRule.fromString(periodString);
+ const start = new Date(eventDateStart);
+ const localDtstart = new Date(
+ start.getFullYear(),
+ start.getMonth(),
+ start.getDate(),
+ start.getHours(),
+ start.getMinutes(),
+ start.getSeconds(),
+ );
return {
...rrule.origOptions,
- dtstart: new Date(eventDateStart),
+ dtstart: localDtstart,
interval: rrule.origOptions.interval || 1,
};
}
@@ -62,15 +71,14 @@ export function useRecurrence() {
if (!rrule) return [event];
const dates = rrule.all((date, i) => i < count);
- const start = new Date(event.date_start);
- const end = new Date(event.date_end);
- const duration = end - start;
- return dates.map((date, index) => ({
+ const duration = new Date(event.date_end) - new Date(event.date_start);
+
+ return dates.map((date) => ({
id: event.id,
title: event.name,
start: date,
- end: (date.getTime() + duration),
+ end: date.getTime() + duration,
allDay: event.allday,
extendedProps: {
originalEventId: event.id,
diff --git a/src/front/src/components/calendar_of_events/event-create.vue b/src/front/src/components/calendar_of_events/event-create.vue
index 9dca2d6ef..fb7a0b855 100644
--- a/src/front/src/components/calendar_of_events/event-create.vue
+++ b/src/front/src/components/calendar_of_events/event-create.vue
@@ -104,45 +104,51 @@
-
-
-
-
-
- Окончание события
+
+ Повтор события
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -591,6 +597,14 @@ export default {
let postEvent = new FormData();
+ // if (propsEvent.value.event.allday && propsEvent.value.event.period?.includes('DTSTART')) {
+ // // убираем суффикс Z (UTC), чтобы не было смещения на день
+ // propsEvent.value.event.period = propsEvent.value.event.period.replace(
+ // 'Z\nRRULE',
+ // '\nRRULE',
+ // );
+ // }
+
postEvent.append(
'event',
JSON.stringify({ ...propsEvent.value.event, files: propsEvent.value.event.files }),
@@ -666,13 +680,30 @@ export default {
const dtstart = new Date(propsEvent.value.event.date_start);
+ const localDtstart = new Date(
+ dtstart.getFullYear(),
+ dtstart.getMonth(),
+ dtstart.getDate(),
+ dtstart.getHours(),
+ dtstart.getMinutes(),
+ dtstart.getSeconds(),
+ );
+
const ruleOptions = {
...rule.rule,
- dtstart: dtstart,
+ dtstart: localDtstart,
};
if (showRepeatEnd.value && repeatEndDate.value) {
- ruleOptions.until = new Date(repeatEndDate.value);
+ const untilDate = new Date(repeatEndDate.value);
+ ruleOptions.until = new Date(
+ untilDate.getFullYear(),
+ untilDate.getMonth(),
+ untilDate.getDate(),
+ untilDate.getHours(),
+ untilDate.getMinutes(),
+ untilDate.getSeconds(),
+ );
}
if (rule.rule.freq === RRule.WEEKLY) {