forked from jwoglom/tconnectsync
-
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.
Issue jwoglom#56 Put a common replace_with_user_tz() function that de…
…faults to using the TIMEZONE_NAME tz in the users .env file, defaults to 'America/New_York' if no .env file. Updated the applicable date strings with -04:00 in test_therapy_event.py and it seems to work for me, test come back ok
- Loading branch information
Showing
3 changed files
with
23 additions
and
12 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
Empty file.
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,10 @@ | ||
import arrow | ||
from tconnectsync.secret import TIMEZONE_NAME | ||
|
||
""" | ||
Replaces timezone in string with provided timezone string, defaults to 'America/New_York' | ||
Example 1: replace_datetime_tz("2021-04-01 23:15:30-04:00") | ||
Example 2: replace_datetime_tz("2021-04-01 23:15:30-04:00", 'America/Chicago') | ||
""" | ||
def replace_with_user_tz(date, tz=TIMEZONE_NAME): | ||
return arrow.get(date, tzinfo=tz).format() |