diff --git a/src/components/PlanInfo.tsx b/src/components/PlanInfo.tsx
index 0f29571..c33d0ca 100644
--- a/src/components/PlanInfo.tsx
+++ b/src/components/PlanInfo.tsx
@@ -5,7 +5,12 @@ export default function PlanInfo({ parsedData }: { parsedData: PublicNoteData })
return null
}
- const extraList = parsedData.planDataMod.extra.split(",").length > 1 ? parsedData.planDataMod.extra.split(",") : parsedData.planDataMod.extra.split(",")[0] === "" ? [] : [parsedData.planDataMod.extra]
+ const extraList =
+ parsedData.planDataMod.extra.split(",").length > 1
+ ? parsedData.planDataMod.extra.split(",")
+ : parsedData.planDataMod.extra.split(",")[0] === ""
+ ? []
+ : [parsedData.planDataMod.extra]
return (
- {extra} -
- ) - }) - } - + {extraList.map((extra, index) => { + return ( ++ {extra} +
+ ) + })} ) } diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 3777f5b..81743ce 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -109,21 +109,24 @@ export function getDaysBetweenDatesWithAutoRenewal({ } } + if (nowTime < endTime) { + return { + days: getDaysBetweenDates(endDate, new Date(nowTime).toISOString()), + cycleLabel: cycleLabel, + remainingPercentage: + getDaysBetweenDates(endDate, new Date(nowTime).toISOString()) / + (30 * months) > + 1 + ? 1 + : getDaysBetweenDates(endDate, new Date(nowTime).toISOString()) / + (30 * months), + } + } + const nextTime = getNextCycleTime(endTime, months, nowTime) const diff = dayjs(nextTime).diff(dayjs(), "day") + 1 const remainingPercentage = diff / (30 * months) > 1 ? 1 : diff / (30 * months) - console.log( - "nextTime", - nextTime, - "diff", - diff, - "month", - months, - "remainingPercentage", - remainingPercentage, - ) - return { days: diff, cycleLabel: cycleLabel,