From 20321f0bb44df353f19e7786e06fb0234a94542c Mon Sep 17 00:00:00 2001 From: Michiel Scholten Date: Fri, 22 Nov 2024 13:05:52 +0100 Subject: [PATCH] Use UTC for calculating the current game --- src/alfagok/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/alfagok/main.py b/src/alfagok/main.py index 9f94459..38fa576 100644 --- a/src/alfagok/main.py +++ b/src/alfagok/main.py @@ -1,6 +1,6 @@ """Main alfagok API application.""" import logging -from datetime import date +from datetime import date, datetime, timezone from typing import Union from fastapi import FastAPI, Request @@ -51,7 +51,7 @@ if settings.debug: def get_game_id(): """Calculate the index for the game/word we are handling today.""" - today = date.today() + today = datetime.now(timezone.utc).date() # Calculate the amount of days since the start of the games so we know which word is used today return (today - settings.start_date).days @@ -71,7 +71,7 @@ async def index(request: Request): @app.get('/api/game') def what_game(): - """Handle incoming guess.""" + """Which game is currently on?""" return {'game': get_game_id()}