Skip to content

Commit

Permalink
fix: parse timezone from timestamp
Browse files Browse the repository at this point in the history
This relies on pulling the timestamp from the string instead of defaulting to UTC
closes #1350
  • Loading branch information
alandtse committed Aug 3, 2021
1 parent 684205a commit c7dc5f2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions custom_components/alexa_media/alexa_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
For more details about this platform, please refer to the documentation at
https://community.home-assistant.io/t/echo-devices-alexa-as-media-player-testers-needed/58639
"""
from datetime import datetime, timezone
from datetime import datetime
import json
import logging
import re
Expand Down Expand Up @@ -324,8 +324,8 @@ def is_cap_state_still_acceptable(
if formatted_time_of_sample:
try:
time_of_sample = datetime.strptime(
formatted_time_of_sample, "%Y-%m-%dT%H:%M:%S.%fZ"
).replace(tzinfo=timezone.utc)
formatted_time_of_sample, "%Y-%m-%dT%H:%M:%S.%f%z"
)
return time_of_sample >= since
except ValueError:
pass
Expand Down

0 comments on commit c7dc5f2

Please sign in to comment.