Event Edit: fix handling of recurring events with an until field.
It was slightly the wrong type because of typings were wrong. We now explicitly convert it.master
parent
7b22e0e76b
commit
d268c0fab6
|
@ -107,7 +107,13 @@ class EventEdit extends React.PureComponent<PropsType> {
|
|||
this.state.location = event.location ? event.location : '';
|
||||
this.state.description = event.description ? event.description : '';
|
||||
this.state.timezone = event.timezone;
|
||||
this.state.rrule = this.props.item?.component.getFirstPropertyValue<ICAL.Recur>('rrule')?.toJSON();
|
||||
const rruleProp = this.props.item?.component.getFirstPropertyValue<ICAL.Recur>('rrule');
|
||||
if (rruleProp) {
|
||||
this.state.rrule = rruleProp.toJSON();
|
||||
if (rruleProp.until) {
|
||||
this.state.rrule.until = rruleProp.until;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.state.uid = uuid.v4();
|
||||
}
|
||||
|
|
|
@ -175,6 +175,8 @@ declare module 'ical.js' {
|
|||
|
||||
export class Recur {
|
||||
constructor(data?: RecurData);
|
||||
public toJSON(): RecurData;
|
||||
public until: Time | null;
|
||||
|
||||
public toJSON(): Omit<RecurData, 'until'> & { until?: string };
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue