From f5ad205835eb976b3d93c8a13a0521e2e8738101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Ja=C5=A1ek?= Date: Fri, 20 Dec 2024 09:53:59 +0100 Subject: [PATCH] fix events time TBC handling (#2167) STT-40 --- client/components/fields/editor/EventSchedule.tsx | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/client/components/fields/editor/EventSchedule.tsx b/client/components/fields/editor/EventSchedule.tsx index d54fb470c..0fec93088 100644 --- a/client/components/fields/editor/EventSchedule.tsx +++ b/client/components/fields/editor/EventSchedule.tsx @@ -88,6 +88,7 @@ export class EditorFieldEventSchedule extends React.PureComponent { 'dates.end': endDate ? localDateToUtc(endDate, this.props.item?.dates?.tz) : null, 'dates.all_day': true, 'dates.no_end_time': false, + [TO_BE_CONFIRMED_FIELD]: false, }; this.props.onChange(changes); @@ -99,10 +100,10 @@ export class EditorFieldEventSchedule extends React.PureComponent { 'dates.start': newStartDate, 'dates.all_day': false, 'dates.no_end_time': this.props.item.dates.no_end_time ?? true, + [TO_BE_CONFIRMED_FIELD]: false, }; changes['_startTime'] = newStartDate; - this.setToBeConfirmed(changes); this.props.onChange(changes); } @@ -143,6 +144,7 @@ export class EditorFieldEventSchedule extends React.PureComponent { : null, 'dates.all_day': !hasStartTime, 'dates.no_end_time': hasStartTime, + [TO_BE_CONFIRMED_FIELD]: false, }; this.props.onChange(changes); @@ -159,19 +161,12 @@ export class EditorFieldEventSchedule extends React.PureComponent { 'dates.end': newEndDate, 'dates.all_day': false, 'dates.no_end_time': false, + [TO_BE_CONFIRMED_FIELD]: false, }; - this.setToBeConfirmed(changes); this.props.onChange(changes); } - setToBeConfirmed(changes) { - if ((changes['_startTime'] || this.props.item._startTime) && - (changes['_endTime'] || this.props.item._endTime)) { - changes[TO_BE_CONFIRMED_FIELD] = false; - } - } - changeTimezone(_: string, timezone?: string) { const dtFormat = 'DD/MM/YYYY HH:mm'; const dates = this.props.item?.dates ?? {};