private _buildCalendarEventFromFields()

in legacy/src/Calendar/Dialogs.ts [371:409]


    private _buildCalendarEventFromFields(): PromiseLike<any> {
        if (this._$startInput) {
            this._calendarEvent.startDate = Utils_Date.shiftToLocal(
                Utils_Date.parseDateString(this._$startInput.val(), Culture.getDateTimeFormat().ShortDatePattern, true),
            ).toISOString();
        }
        if (this._$endInput) {
            this._calendarEvent.endDate = Utils_Date.shiftToLocal(
                Utils_Date.parseDateString(this._$endInput.val(), Culture.getDateTimeFormat().ShortDatePattern, true),
            ).toISOString();
        }
        if (this._$titleInput) {
            this._calendarEvent.title = $.trim(this._$titleInput.val());
        }

        const promises: PromiseLike<any>[] = [];
        // create event data from text fields
        const textFields = this._content.textFields;
        const textInputs = this._$textInputs;
        for (let i = 0; i < textInputs.length; i++) {
            if (textFields[i].okCallback) {
                promises.push(textFields[i].okCallback(textInputs[i].val()));
            } else if (textFields[i].eventProperty) {
                this._calendarEvent[textFields[i].eventProperty] = $.trim(textInputs[i].val());
            }
        }
        // create event data from combo fields
        const comboFields = this._content.comboFields;
        const comboInputs = this._$comboInputs;
        for (let i = 0; i < comboInputs.length; i++) {
            if (comboFields[i].okCallback) {
                promises.push(comboFields[i].okCallback(comboInputs[i].val()));
            } else if (comboFields[i].eventProperty) {
                this._calendarEvent[comboFields[i].eventProperty] = $.trim(comboInputs[i].val());
            }
        }

        return Promise.all(promises);
    }