fix(frontend): format 6-digit EES academic year codes correctly
All checks were successful
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 32s
Build and Push Docker Images / Build Frontend (Next.js) (push) Successful in 1m5s
Build and Push Docker Images / Build Pipeline (Meltano + dbt + Airflow) (push) Successful in 31s
Build and Push Docker Images / Trigger Portainer Update (push) Successful in 1s

formatAcademicYear now handles both 4-digit (2023→2023/24) and 6-digit
EES codes (202526→2025/26). Applied to all year displays: SATs, phonics,
admissions, finances, and the yearly results table.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-27 18:30:37 +00:00
parent 7724fe3503
commit cd1c649d0f
2 changed files with 13 additions and 7 deletions

View File

@@ -338,9 +338,15 @@ export function parseQueryString(search: string): Record<string, string> {
// ============================================================================
/**
* Format academic year (e.g., 2023 -> "2023/24")
* Format academic year.
* Handles both 4-digit start years (2023 → "2023/24") and
* 6-digit EES codes (202526 → "2025/26").
*/
export function formatAcademicYear(year: number): string {
const s = year.toString();
if (s.length === 6) {
return `${s.slice(0, 4)}/${s.slice(4)}`;
}
const nextYear = (year + 1).toString().slice(-2);
return `${year}/${nextYear}`;
}