Calendar: More checks to avoid 0 duration events

This commit is contained in:
nathangray 2020-10-06 13:55:06 -06:00
parent 0bc8fc9100
commit 4410866ceb
3 changed files with 24 additions and 0 deletions

View File

@ -359,6 +359,11 @@ class calendar_uiforms extends calendar_ui
unset($content['alarm'][$id]);
}
}
if($content['end'] && $content['start'] >= $content['end'])
{
unset($content['end']);
$content['duration'] = $this->bo->cal_prefs['defaultlength']*60;
}
if ($content['duration'])
{
$content['end'] = $content['start'] + $content['duration'];

View File

@ -1287,6 +1287,14 @@ var CalendarApp = /** @class */ (function (_super) {
if (recur_end && recur_end.getValue && !recur_end.getValue()) {
recur_end.set_min(widget.getValue());
}
// Update end date, min duration is 1 minute
var end = widget.getRoot().getDOMWidgetById('end');
var start_time = new Date(widget.getValue());
var end_time = new Date(end.getValue());
if (end_time <= start_time) {
start_time.setMinutes(start_time.getMinutes() + 1);
end.set_value(start_time);
}
}
// Update currently selected alarm time
this.alarm_custom_date();

View File

@ -1347,9 +1347,20 @@ class CalendarApp extends EgwApp
{
recur_end.set_min(widget.getValue());
}
// Update end date, min duration is 1 minute
let end = <et2_date> widget.getRoot().getDOMWidgetById('end');
let start_time = new Date(widget.getValue());
let end_time = new Date(end.getValue());
if(end_time <= start_time)
{
start_time.setMinutes(start_time.getMinutes() + 1);
end.set_value(start_time);
}
}
// Update currently selected alarm time
this.alarm_custom_date();
}
/**