(monthsStr: string)
| 1088 | const cached = localStorage.getItem(CROP_PLAN_CACHE_KEY); |
| 1089 | return cached ? JSON.parse(cached) : {}; |
| 1090 | } catch { |
| 1091 | return {}; |
| 1092 | } |
| 1093 | } |
| 1094 | |
| 1095 | function setPlanCache(cacheKey: string, data: CropPlan) { |
| 1096 | const cache = getPlanCache(); |
| 1097 | cache[cacheKey] = { data, timestamp: Date.now() }; |
| 1098 | localStorage.setItem(CROP_PLAN_CACHE_KEY, JSON.stringify(cache)); |
| 1099 | } |
| 1100 | |
| 1101 | function parseMonthRange(monthsStr: string): number[] { |
| 1102 | const parts = monthsStr.split("-").map((s) => s.trim().substring(0, 3)); |
| 1103 | if (parts.length !== 2) return []; |
| 1104 | const startIdx = MONTHS.findIndex((m) => m.toLowerCase() === parts[0].toLowerCase()); |
| 1105 | const endIdx = MONTHS.findIndex((m) => m.toLowerCase() === parts[1].toLowerCase()); |
| 1106 | if (startIdx === -1 || endIdx === -1) return []; |
| 1107 | |
| 1108 | const indices: number[] = []; |
no outgoing calls
no test coverage detected