Skip to content

Commit eeeb21d

Browse files
fix start/end type for unspecified start/end-date
1 parent 4ec9062 commit eeeb21d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

vtools/functions/read_dss.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ def read_dss(
7070
# Set default start_date and end_date to cover the full period of record if not specified
7171
tt_full = tsi[0]
7272
if start_date is None:
73-
start_date = tt_full.index[0]
73+
start_date = tt_full.index[0].to_timestamp()
7474
if end_date is None:
75-
end_date = tt_full.index[-1]
76-
if (tt_full.index[0].to_timestamp() > pd.to_datetime(end_date)) or (
77-
tt_full.index[-1].to_timestamp() < pd.to_datetime(start_date)
75+
end_date = tt_full.index[-1].to_timestamp()
76+
if tt_full.index[0].to_timestamp() > end_date or (
77+
tt_full.index[-1].to_timestamp() < start_date
7878
):
7979
raise ValueError(
8080
f"File: {filename} does not cover the dates requested. \n\tRequested dates are: {start_date} to {end_date}, \n\tand the file covers {tt_full.index[0]} to {tt_full.index[-1]}"

0 commit comments

Comments
 (0)