Skip to main content

Function: redateDefaultSeasons()

redateDefaultSeasons(def, query, today?): void

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

The re-dating in sdv-py nba_stats_runtime._get: each wrapper-filled Season / SeasonYear becomes the latest season with rows for the request's LeagueID (else the host's league), endpoint (the path's last segment) and SeasonType.

Parameters​

def​

The flat wrapper's def: host (a host containing "wnba" means league "10", else "00", when the query has no LeagueID) and path (its last segment is the endpoint).

host?​

string

path?​

string

query​

Record<string, any>

The resolved query params, mutated in place: a Season / SeasonYear that is a DefaultSeason is replaced by a plain string label; caller-supplied values are left alone. LeagueID and SeasonType are read.

today?​

Date = ...

The date to evaluate on; defaults to new Date().

Returns​

void

Nothing; the result is the mutation of query.

Remarks​

Only DefaultSeason values are touched, so an explicit season (even "") never changes. Called by the flat resolver after the transforms run.

Example​

import { redateDefaultSeasons, season_latest_with_data } from "./transforms.js";
const query = { Season: season_latest_with_data(undefined), SeasonType: "Playoffs" };
redateDefaultSeasons({ host: "stats.nba.com", path: "/stats/leaguegamelog" }, query);
typeof query.Season; // "string" (e.g. "2025-26", dated by the playoff rule)