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