Fix issue with yearly recurrence.

Should fix #158.
master
Tom Hacohen 4 years ago
parent c4d239dba3
commit 562dc48610

@ -85,7 +85,7 @@ const menuItemsWeekDays = weekdays.map((day) => {
function makeArray<T>(item: T) {
if (item === undefined) {
return item;
return [];
} else if (Array.isArray(item)) {
return item;
} else {
@ -95,16 +95,12 @@ function makeArray<T>(item: T) {
function sanitizeByDay(item: string | string[] | undefined) {
const ret = makeArray(item);
if (Array.isArray(ret)) {
return (ret as string[]).map((value) => {
if (parseInt(value) === 1) {
return value.substr(1);
}
return value;
});
} else {
return [];
}
}
const styles = {
@ -250,7 +246,7 @@ export default function RRule(props: PropsType) {
<InputLabel>Months</InputLabel>
<Select
style={styles.multiSelect}
value={makeArray(options.bymonth)}
value={makeArray(options.bymonth) ?? []}
multiple
onChange={(event: React.ChangeEvent<{ value: unknown }>) => {
const value = event.target.value as string[];

Loading…
Cancel
Save