diff --git a/packages/web/components/WorkbookView.tsx b/packages/web/components/WorkbookView.tsx index dcc578e..9e02575 100644 --- a/packages/web/components/WorkbookView.tsx +++ b/packages/web/components/WorkbookView.tsx @@ -540,16 +540,23 @@ function HourlyGenerationSheet({ hourly, codYear }: { hourly: HourlyData; codYea const hasData = hasSolar || hasWind; // FY labels: if COD is April 2026, FY 2026-27 = Year 1 + const startYear = codYear || new Date().getFullYear(); const getFyLabel = (yearIndex: number) => { - const startYear = codYear || new Date().getFullYear(); const fyStart = startYear + yearIndex; const fyEnd = fyStart + 1; return `FY ${String(fyStart).slice(-2)}-${String(fyEnd).slice(-2)}`; }; - const getMonthLabel = (month: number, yearIndex: number) => { - const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; - return monthNames[month - 1]; + // Month names - in reverse order (April first for Indian FY starting Apr) + const monthNames = ['Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan', 'Feb', 'Mar']; + // Mapping from position 0-11 to actual month 4-12, 1-3 + const monthPositions = [4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3]; + const getMonthLabel = (pos: number, yearIndex: number) => { + const month = monthPositions[pos]; + const fyStart = startYear + yearIndex; + const fyEnd = fyStart + 1; + const fySuffix = month <= 3 ? String(fyEnd).slice(-2) : String(fyStart).slice(-2); + return `${monthNames[pos]} ${fySuffix}`; }; // Expand state: which years/months/days are expanded @@ -650,15 +657,16 @@ function HourlyGenerationSheet({ hourly, codYear }: { hourly: HourlyData; codYea {hasWind && {Math.round(windYr).toLocaleString()} MWh} - {/* Month rows (expandable) */} + {/* Month rows - reverse order (Apr first for Indian FY) */} {isYearExpanded && [...Array(12)].map((_, mi) => { - const month = mi + 1; + const pos = 11 - mi; // Reverse: 11->0 gives Apr first + const month = monthPositions[pos]; const monthKey = `${year}-${month}`; const isMonthExpanded = expandedMonths.has(monthKey); const solarMo = hasSolar ? computeMonthTotal(year, month, true) : 0; const windMo = hasWind ? computeMonthTotal(year, month, false) : 0; const daysInMonth = MONTH_DAYS[month - 1]; - const monthLabel = getMonthLabel(month, i); + const monthLabel = getMonthLabel(pos, i); return (