From 562dc48610425462322c60a91329d12baf81ba55 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 19 Aug 2020 20:40:27 +0300 Subject: [PATCH] Fix issue with yearly recurrence. Should fix #158. --- src/widgets/RRule.tsx | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/widgets/RRule.tsx b/src/widgets/RRule.tsx index 24859ee..e7b8ddd 100644 --- a/src/widgets/RRule.tsx +++ b/src/widgets/RRule.tsx @@ -85,7 +85,7 @@ const menuItemsWeekDays = weekdays.map((day) => { function makeArray(item: T) { if (item === undefined) { - return item; + return []; } else if (Array.isArray(item)) { return item; } else { @@ -95,16 +95,12 @@ function makeArray(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 []; - } + return (ret as string[]).map((value) => { + if (parseInt(value) === 1) { + return value.substr(1); + } + return value; + }); } const styles = { @@ -250,7 +246,7 @@ export default function RRule(props: PropsType) { Months