Skip to content

Commit

Permalink
add memorial holiday
Browse files Browse the repository at this point in the history
  • Loading branch information
MuslemRahimi committed May 27, 2024
1 parent f0bc3ce commit 2a160b0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/GetStartEndDate.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ def __init__(self):

def check_if_holiday(self):
holiday_dates = {
datetime(2023, 5, 29): 'memorial_day',
datetime(2023, 6, 19): 'independence_day',
datetime(2023, 6, 20): 'independence_day+1',
datetime(2023, 9, 4): 'labor_day',
Expand All @@ -19,6 +18,7 @@ def check_if_holiday(self):
datetime(2024, 1, 1): 'new_year',
datetime(2024, 1, 15): 'martin_luther_king',
datetime(2024, 2, 19): 'washington_birthday',
datetime(2024, 5, 27): 'memorial_day',
}

for date, name in holiday_dates.items():
Expand All @@ -27,9 +27,7 @@ def check_if_holiday(self):
return None

def correct_1d_interval(self, holiday):
if holiday == 'memorial_day':
start_date_1d = datetime(2023, 5, 26)
elif holiday in ('independence_day', 'independence_day+1'):
if holiday in ('independence_day', 'independence_day+1'):
start_date_1d = datetime(2023, 6, 16)
elif holiday in ('labor_day', 'labor_day+1'):
start_date_1d = datetime(2023, 9, 1)
Expand All @@ -41,6 +39,8 @@ def correct_1d_interval(self, holiday):
start_date_1d = datetime(2023, 1, 12)
elif holiday == 'washington_birthday':
start_date_1d = datetime(2024, 2, 16)
elif holiday == 'memorial_day':
start_date_1d = datetime(2024, 5, 24)
else:
current_time_new_york = datetime.now(self.new_york_tz)
current_weekday = current_time_new_york.weekday()
Expand All @@ -62,7 +62,6 @@ def run(self):
is_afternoon = current_time_new_york.hour > 9 or (current_time_new_york.hour == 9 and current_time_new_york.minute >= 30)
if holiday:
holiday_dates = {
'memorial_day': datetime(2023, 5, 26),
'independence_day': datetime(2023, 6, 16),
'independence_day+1': datetime(2023, 6, 16),
'labor_day': datetime(2023, 9, 1),
Expand All @@ -72,6 +71,7 @@ def run(self):
'new_year': datetime(2023, 12, 29),
'martin_luther_king': datetime(2024, 1, 12),
'washington_birthday': datetime(2024, 2, 16),
'memorial_day': datetime(2024, 5, 24),
}

if holiday in holiday_dates:
Expand Down

0 comments on commit 2a160b0

Please sign in to comment.