rrule: force the interval to be 1 and never empty.

master
Tom Hacohen 5 years ago
parent 116883e207
commit 94d56c4715

@ -98,12 +98,12 @@ export default function RRule(props: PropsType) {
style={{ marginLeft: '0.5em', width: '4em' }} style={{ marginLeft: '0.5em', width: '4em' }}
type="number" type="number"
inputProps={{ min: 1, max: 1000 }} inputProps={{ min: 1, max: 1000 }}
value={options.interval} value={options.interval ?? 1}
onChange={(event: React.FormEvent<{ value: unknown }>) => { onChange={(event: React.FormEvent<{ value: unknown }>) => {
event.preventDefault(); event.preventDefault();
const inputNode = event.currentTarget as HTMLInputElement; const inputNode = event.currentTarget as HTMLInputElement;
if (inputNode.value === '') { if (inputNode.value === '') {
updateRule({ interval: undefined }); updateRule({ interval: 1 });
} else if (inputNode.valueAsNumber) { } else if (inputNode.valueAsNumber) {
updateRule({ interval: inputNode.valueAsNumber }); updateRule({ interval: inputNode.valueAsNumber });
} }

Loading…
Cancel
Save