diff --git a/src/components/EventEdit.tsx b/src/components/EventEdit.tsx index 8f55398..bd3c6d8 100644 --- a/src/components/EventEdit.tsx +++ b/src/components/EventEdit.tsx @@ -220,16 +220,7 @@ class EventEdit extends React.PureComponent { } } if (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('rrule', new ICAL.Recur(this.state.rrule!)); } event.component.updatePropertyWithValue('last-modified', ICAL.Time.now()); diff --git a/src/widgets/RRule.tsx b/src/widgets/RRule.tsx index 1f95552..e532400 100644 --- a/src/widgets/RRule.tsx +++ b/src/widgets/RRule.tsx @@ -80,7 +80,15 @@ interface PropsType { export default function RRule(props: PropsType) { const options = props.rrule; function updateRule(newOptions: Partial): void { - const updatedOptions = { ...options, ...newOptions }; + const updatedOptions: RRuleOptions = { ...options, ...newOptions }; + + for (const key of Object.keys(updatedOptions)) { + const value = updatedOptions[key]; + if ((value === undefined) || (value?.length === 0)) { + delete updatedOptions[key]; + continue; + } + } props.onChange(updatedOptions); } function getEnds(): Ends {