Calendar: fix add alarm only added 5 minutes, regardless of what was selected

This commit is contained in:
nathangray 2020-05-25 11:06:33 -06:00
parent bdbf28cd2c
commit 4f4aa88da8
2 changed files with 16 additions and 18 deletions

View File

@ -2620,22 +2620,21 @@ var CalendarApp = /** @class */ (function (_super) {
*
* @param {widget object} _widget new_alarm[options] selectbox
*/
CalendarApp.prototype.alarm_custom_date = function (_widget) {
var alarm_date = this.et2.getWidgetById('new_alarm[date]');
var alarm_options = _widget || this.et2.getWidgetById('new_alarm[options]');
var start = this.et2.getWidgetById('start');
if (alarm_date && alarm_options
&& start) {
if (alarm_options.get_value() != '0') {
CalendarApp.prototype.alarm_custom_date = function (selectbox, _widget) {
var alarm_date = this.et2.getInputWidgetById('new_alarm[date]');
var alarm_options = _widget || this.et2.getInputWidgetById('new_alarm[options]');
var start = this.et2.getInputWidgetById('start');
if (alarm_date && alarm_options && start) {
if (alarm_options.getValue() != '0') {
alarm_date.set_class('calendar_alarm_date_display');
}
else {
alarm_date.set_class('');
}
var startDate = typeof start.get_value != 'undefined' ? start.get_value() : start.value;
var startDate = typeof start.getValue != 'undefined' ? start.getValue() : start.value;
if (startDate) {
var date = new Date(startDate);
date.setTime(date.getTime() - 1000 * parseInt(alarm_options.get_value()));
date.setTime(date.getTime() - 1000 * parseInt(alarm_options.getValue()));
alarm_date.set_value(date);
}
}

View File

@ -3033,16 +3033,15 @@ class CalendarApp extends EgwApp
*
* @param {widget object} _widget new_alarm[options] selectbox
*/
alarm_custom_date (_widget?)
alarm_custom_date (selectbox : HTMLInputElement, _widget? : et2_selectbox)
{
var alarm_date = this.et2.getWidgetById('new_alarm[date]');
var alarm_options = _widget || this.et2.getWidgetById('new_alarm[options]');
var start = this.et2.getWidgetById('start');
var alarm_date = this.et2.getInputWidgetById('new_alarm[date]');
var alarm_options = _widget || this.et2.getInputWidgetById('new_alarm[options]');
var start = <et2_date>this.et2.getInputWidgetById('start');
if (alarm_date && alarm_options
&& start)
if (alarm_date && alarm_options && start)
{
if (alarm_options.get_value() != '0')
if (alarm_options.getValue() != '0')
{
alarm_date.set_class('calendar_alarm_date_display');
}
@ -3050,11 +3049,11 @@ class CalendarApp extends EgwApp
{
alarm_date.set_class('');
}
var startDate = typeof start.get_value != 'undefined'?start.get_value():start.value;
var startDate = typeof start.getValue != 'undefined'?start.getValue():start.value;
if (startDate)
{
var date = new Date(startDate);
date.setTime(date.getTime() - 1000 * parseInt(alarm_options.get_value()));
date.setTime(date.getTime() - 1000 * parseInt(alarm_options.getValue()));
alarm_date.set_value(date);
}
}