Skip to content

Commit

Permalink
Update prepare_data function
Browse files Browse the repository at this point in the history
  • Loading branch information
MTrab committed Jun 17, 2024
1 parent 6c74c7b commit a74c0e8
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,8 @@ def prepare_data(value, date, tz) -> list: # pylint: disable=invalid-name
"""Get today prices."""
local_tz = dt_util.get_default_time_zone()
dt = dt_util.now(local_tz) # pylint: disable=invalid-name
tmp_offset = str(dt).split(":")
offset = (str(dt).split('+'))[1]

offset = tmp_offset[0]
if len(offset) < 2:
offset = f"0{tmp_offset[0]}"

offset += f":{tmp_offset[1]}"
reslist = []
i = 0
while i < 24:
Expand All @@ -38,7 +33,7 @@ def prepare_data(value, date, tz) -> list: # pylint: disable=invalid-name
hour = f"0{hour}"

# tmpdate = datetime.fromisoformat(f"{date}T{hour}:00:00+{offset}")
tmpdate = dt_util.parse_datetime(f"{date}T{hour}:00:00")
tmpdate = dt_util.parse_datetime(f"{date}T{hour}:00:00+{offset}")
tmp = INTERVAL(value, tmpdate)
if date in tmp.hour.strftime("%Y-%m-%d"):
reslist.append(tmp)
Expand Down

0 comments on commit a74c0e8

Please sign in to comment.