-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix Screen time values incorrect - timezone issue #3 update application client ID pantherale0/ha-familysafety#35
- Loading branch information
1 parent
30371db
commit 40340f9
Showing
5 changed files
with
27 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
"""Helper functions for pyfamilysafety.""" | ||
|
||
from datetime import datetime | ||
from dateutil import tz | ||
|
||
API_TIMEZONE = tz.tzutc() | ||
LOCAL_TIMEZONE = tz.tzlocal() | ||
|
||
def localise_datetime(dt: datetime) -> datetime: | ||
"""Localise the datetime into the current timezone.""" | ||
return dt.replace(tzinfo=LOCAL_TIMEZONE) | ||
|
||
def standardise_datetime(dt: datetime) -> datetime: | ||
"""Standardise the datetime into UTC.""" | ||
return dt.replace(tzinfo=API_TIMEZONE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters