Calendar: Adding alarms sometimes gave incorrect "can't add alarms in the past" error

Was not sending all values correctly
This commit is contained in:
nathan 2023-06-06 11:49:41 -06:00
parent bb34db801c
commit 3a19a93b9a

View File

@ -48,7 +48,7 @@ import {et2_checkbox} from "../../api/js/etemplate/et2_widget_checkbox";
import {et2_grid} from "../../api/js/etemplate/et2_widget_grid"; import {et2_grid} from "../../api/js/etemplate/et2_widget_grid";
import {Et2Textbox} from "../../api/js/etemplate/Et2Textbox/Et2Textbox"; import {Et2Textbox} from "../../api/js/etemplate/Et2Textbox/Et2Textbox";
import "./SidemenuDate"; import "./SidemenuDate";
import {formatDate, formatTime, parseDate} from "../../api/js/etemplate/Et2Date/Et2Date"; import {Et2Date, formatDate, formatTime, parseDate} from "../../api/js/etemplate/Et2Date/Et2Date";
import {EGW_KEY_PAGE_DOWN, EGW_KEY_PAGE_UP} from "../../api/js/egw_action/egw_action_constants"; import {EGW_KEY_PAGE_DOWN, EGW_KEY_PAGE_UP} from "../../api/js/egw_action/egw_action_constants";
import {nm_action} from "../../api/js/etemplate/et2_extension_nextmatch_actions"; import {nm_action} from "../../api/js/etemplate/et2_extension_nextmatch_actions";
import flatpickr from "flatpickr"; import flatpickr from "flatpickr";
@ -1433,16 +1433,16 @@ export class CalendarApp extends EgwApp
if(widget) if(widget)
{ {
var recur_end = widget.getRoot().getWidgetById('recur_enddate'); var recur_end = widget.getRoot().getWidgetById('recur_enddate');
if(recur_end && recur_end.getValue && !recur_end.getValue()) if(recur_end && recur_end.getValue && !recur_end.value)
{ {
recur_end.set_min(widget.getValue()); recur_end.set_min(widget.value);
} }
// Update end date, min duration is 1 minute // Update end date, min duration is 1 minute
let end = <et2_date>widget.getRoot().getWidgetById('end'); let end = <Et2Date>widget.getRoot().getWidgetById('end');
let start_time = new Date(widget.getValue()); let start_time = new Date(widget.value);
let end_time = new Date(end.getValue()); let end_time = new Date(end.value);
if(end.getValue() && end_time <= start_time) if(end.value && end_time <= start_time)
{ {
start_time.setMinutes(start_time.getMinutes() + 1); start_time.setMinutes(start_time.getMinutes() + 1);
end.set_value(start_time); end.set_value(start_time);
@ -3392,9 +3392,9 @@ export class CalendarApp extends EgwApp
*/ */
alarm_custom_date (selectbox? : HTMLInputElement, _widget? : et2_selectbox) alarm_custom_date (selectbox? : HTMLInputElement, _widget? : et2_selectbox)
{ {
var alarm_date = this.et2.getInputWidgetById('new_alarm[date]'); var alarm_date = this.et2.getWidgetById('new_alarm[date]');
var alarm_options = _widget || this.et2.getInputWidgetById('new_alarm[options]'); var alarm_options = _widget || this.et2.getWidgetById('new_alarm[options]');
var start = <et2_date>this.et2.getInputWidgetById('start'); var start = <Et2Date><unknown>this.et2.getWidgetById('start');
if (alarm_date && alarm_options && start) if (alarm_date && alarm_options && start)
{ {