rrule: handle empty/undefined values

master
Tom Hacohen 2020-01-14 21:24:41 +02:00
parent 94d56c4715
commit af65d20444
1 changed files with 10 additions and 1 deletions

View File

@ -220,7 +220,16 @@ class EventEdit extends React.PureComponent<PropsType> {
}
}
if (this.state.rrule) {
event.component.updatePropertyWithValue('rrule', new ICAL.Recur(this.state.rrule!));
const rruleData: ICAL.RecurData = {};
for (const key of Object.keys(this.state.rrule)) {
const value = this.state.rrule[key];
if ((value === undefined) || (value?.length === 0)) {
continue;
}
rruleData[key] = value;
}
event.component.updatePropertyWithValue('rrule', new ICAL.Recur(rruleData));
}
event.component.updatePropertyWithValue('last-modified', ICAL.Time.now());