Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest season function should return the next season if there are multiple future seasons defined #152

Open
toddrob99 opened this issue Jan 30, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@toddrob99
Copy link
Owner

Identified in #151, MLB has defined 2025 and 2026 seasons prior to the 2025 season starting. As a result, latest_season() returns 2026 when the expected "latest season" is the upcoming 2025.

https://statsapi.mlb.com/api/v1/seasons/all?sportId=1

Response on 30 Jan 2025 (seasons prior to 2024 removed from response):

{
  "copyright": "Copyright 2025 MLB Advanced Media, L.P.  Use of any content on this page acknowledges agreement to the terms posted here http://gdx.mlb.com/components/copyright.txt",
  "seasons": [
    {
      "seasonId": "2024",
      "hasWildcard": true,
      "preSeasonStartDate": "2024-01-01",
      "preSeasonEndDate": "2024-02-21",
      "seasonStartDate": "2024-02-22",
      "springStartDate": "2024-02-22",
      "springEndDate": "2024-03-26",
      "regularSeasonStartDate": "2024-03-20",
      "lastDate1stHalf": "2024-07-14",
      "allStarDate": "2024-07-16",
      "firstDate2ndHalf": "2024-07-19",
      "regularSeasonEndDate": "2024-09-30",
      "postSeasonStartDate": "2024-10-01",
      "postSeasonEndDate": "2024-10-30",
      "seasonEndDate": "2024-10-30",
      "offseasonStartDate": "2024-10-31",
      "offSeasonEndDate": "2024-12-31",
      "seasonLevelGamedayType": "P",
      "gameLevelGamedayType": "P",
      "qualifierPlateAppearances": 3.1,
      "qualifierOutsPitched": 3
    },
    {
      "seasonId": "2025",
      "hasWildcard": true,
      "preSeasonStartDate": "2025-01-01",
      "preSeasonEndDate": "2025-02-19",
      "seasonStartDate": "2025-02-20",
      "springStartDate": "2025-02-20",
      "springEndDate": "2025-03-25",
      "regularSeasonStartDate": "2025-03-26",
      "lastDate1stHalf": "2025-07-14",
      "allStarDate": "2025-07-15",
      "firstDate2ndHalf": "2025-07-19",
      "regularSeasonEndDate": "2025-09-28",
      "postSeasonStartDate": "2025-09-30",
      "postSeasonEndDate": "2025-10-31",
      "seasonEndDate": "2025-10-31",
      "offseasonStartDate": "2025-11-01",
      "offSeasonEndDate": "2025-12-31",
      "seasonLevelGamedayType": "P",
      "gameLevelGamedayType": "P",
      "qualifierPlateAppearances": 3.1,
      "qualifierOutsPitched": 3
    },
    {
      "seasonId": "2026",
      "hasWildcard": true,
      "preSeasonStartDate": "2026-01-01",
      "preSeasonEndDate": "2026-02-19",
      "seasonStartDate": "2026-02-20",
      "springStartDate": "2026-02-20",
      "springEndDate": "2026-03-25",
      "regularSeasonStartDate": "2026-03-26",
      "lastDate1stHalf": "2026-07-14",
      "allStarDate": "2026-07-15",
      "firstDate2ndHalf": "2026-07-19",
      "regularSeasonEndDate": "2026-09-28",
      "postSeasonStartDate": "2026-09-30",
      "postSeasonEndDate": "2026-10-31",
      "seasonEndDate": "2026-10-31",
      "offseasonStartDate": "2026-11-01",
      "offSeasonEndDate": "2026-12-31",
      "seasonLevelGamedayType": "P",
      "gameLevelGamedayType": "P",
      "qualifierPlateAppearances": 3.1,
      "qualifierOutsPitched": 3
    }
  ]
}
@toddrob99 toddrob99 added the bug Something isn't working label Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant