Skip to content

Commit d9b3c95

Browse files
authored
fixed (#329)
1 parent 29bec90 commit d9b3c95

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

quartz_solar_forecast/forecast.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,13 @@ def predict_tryolabs(site: PVSite, ts: datetime | str = None):
8282

8383
# set start and end time, if no time is given use current time
8484
if ts is None:
85-
start_date = pd.Timestamp.now().strftime("%Y-%m-%d")
86-
start_time = pd.Timestamp.now().round(freq="h")
85+
now = pd.Timestamp.now()
86+
start_date = now.strftime("%Y-%m-%d")
87+
start_time = now.round(freq="h")
8788
else:
88-
start_date = pd.Timestamp(ts).strftime("%Y-%m-%d")
89-
start_time = pd.Timestamp(ts).round(freq="h")
89+
ts_pd = pd.Timestamp(ts)
90+
start_date = ts_pd.strftime("%Y-%m-%d")
91+
start_time = ts_pd.round(freq="h")
9092

9193
end_time = start_time + pd.Timedelta(hours=48)
9294
start_date_datetime = datetime.strptime(start_date, "%Y-%m-%d")

0 commit comments

Comments
 (0)