From 43854f3fd551770152213d9b99935db24d411767 Mon Sep 17 00:00:00 2001 From: ZeroWave022 <36341766+ZeroWave022@users.noreply.github.com> Date: Wed, 11 Oct 2023 23:00:55 +0200 Subject: [PATCH] fix(locforecast): Converting time when hour is 23 --- yr_weather/data/locationforecast.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/yr_weather/data/locationforecast.py b/yr_weather/data/locationforecast.py index fa5b02d..9d7d490 100644 --- a/yr_weather/data/locationforecast.py +++ b/yr_weather/data/locationforecast.py @@ -1,6 +1,6 @@ """Classes storing data used by yr_weather.locationforecast""" -from datetime import datetime +from datetime import datetime, timedelta from typing import Optional, List from dataclasses import dataclass, fields @@ -198,7 +198,9 @@ def __init__(self, forecast_data: APIForecast) -> None: def _conv_to_nearest_hour(self, date: datetime) -> datetime: if date.minute >= 30: - return date.replace(microsecond=0, second=0, minute=0, hour=date.hour + 1) + return date.replace( + microsecond=0, second=0, minute=0, hour=date.hour + ) + timedelta(hours=1) return date.replace(microsecond=0, second=0, minute=0)