Fix issue with yearly recurrence.

Should fix #158.
master
Tom Hacohen 4 years ago
parent 3ce158ca88
commit 1565772933

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

Loading…
Cancel
Save