Skip to main content

Function: format_nhl_season()

format_nhl_season(season): unknown

Defined in: src/core/transforms.ts:90

sportsdataverse._codegen_runtime.format_nhl_season: a 4-digit end year becomes the 8-digit api-web season (2025 -> "20242025"); an 8-digit value passes through as a string. Anything else throws.

Parameters​

season​

unknown

A 4-digit END year (number or string) or an 8-digit YYYYYYYY season; null / undefined pass through unchanged.

Returns​

unknown

The 8-digit season as a string, or the nullish input.

Throws​

Error Unrecognized NHL season <json> for any other value (e.g. "24-25", 202425).

Remarks​

The 4-digit input is the season's END year, so 2025 is 2024-25.

Example​

import { format_nhl_season } from "./transforms.js";
format_nhl_season(2025); // "20242025"
format_nhl_season("20232024"); // "20232024"