Skip to content

Commit

Permalink
fix events time TBC handling
Browse files Browse the repository at this point in the history
STT-40
  • Loading branch information
petrjasek committed Dec 20, 2024
1 parent 31cb5f9 commit ffb1423
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions client/components/fields/editor/EventSchedule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export class EditorFieldEventSchedule extends React.PureComponent<IProps> {
'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);
Expand All @@ -99,10 +100,10 @@ export class EditorFieldEventSchedule extends React.PureComponent<IProps> {
'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);
}

Expand Down Expand Up @@ -143,6 +144,7 @@ export class EditorFieldEventSchedule extends React.PureComponent<IProps> {
: null,
'dates.all_day': !hasStartTime,
'dates.no_end_time': hasStartTime,
[TO_BE_CONFIRMED_FIELD]: false,
};

this.props.onChange(changes);
Expand All @@ -159,19 +161,12 @@ export class EditorFieldEventSchedule extends React.PureComponent<IProps> {
'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 ?? {};
Expand Down

0 comments on commit ffb1423

Please sign in to comment.