[books] Move one off creator to profile utils
This commit is contained in:
@ -1,9 +1,10 @@
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import pendulum
|
||||
import pytz
|
||||
from django.conf import settings
|
||||
from django.utils import timezone
|
||||
import calendar
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
# need to translate to a non-naive timezone, even if timezone == settings.TIME_ZONE, so we can compare two dates
|
||||
def to_user_timezone(date, profile):
|
||||
@ -56,3 +57,42 @@ def end_of_month(dt, profile) -> datetime:
|
||||
|
||||
def start_of_year(dt, profile) -> datetime:
|
||||
return start_of_day(dt, profile).replace(month=1, day=1)
|
||||
|
||||
|
||||
def one_off_fix_colins_profile(profile):
|
||||
home_tz = "America/New_York"
|
||||
|
||||
europe = "2022-10-15"
|
||||
europe_tz = "Europe/Paris"
|
||||
europe_end = "2023-12-15"
|
||||
|
||||
washington = "2023-04-28"
|
||||
washington_tz = "America/Los_Angeles"
|
||||
washington_end = "2023-05-04"
|
||||
|
||||
camp = "2024-08-04"
|
||||
camp_end = "2024-08-10"
|
||||
camp_tz = "America/Halifax"
|
||||
|
||||
summer = "2025-07-09 12:00:00"
|
||||
summer_end = "2025-07-13 20:30:00"
|
||||
summer_tz = "America/Los_Angeles"
|
||||
|
||||
profile.timezone_change_log = ""
|
||||
profile.timezone_change_log += f"{europe_tz} - {pendulum.parse(europe)}\n"
|
||||
profile.timezone_change_log += (
|
||||
f"{home_tz} - {pendulum.parse(europe_end)}\n"
|
||||
)
|
||||
profile.timezone_change_log += (
|
||||
f"{washington_tz} - {pendulum.parse(washington)}\n"
|
||||
)
|
||||
profile.timezone_change_log += (
|
||||
f"{home_tz} - {pendulum.parse(washington_end)}\n"
|
||||
)
|
||||
profile.timezone_change_log += f"{camp_tz} - {pendulum.parse(camp)}\n"
|
||||
profile.timezone_change_log += f"{home_tz} - {pendulum.parse(camp_end)}\n"
|
||||
profile.timezone_change_log += f"{summer_tz} - {pendulum.parse(summer)}\n"
|
||||
profile.timezone_change_log += (
|
||||
f"{home_tz} - {pendulum.parse(summer_end)}\n"
|
||||
)
|
||||
profile.save()
|
||||
|
||||
Reference in New Issue
Block a user