add memorial holiday
This commit is contained in:
parent
f0bc3ce6bc
commit
2a160b02e2
@ -9,7 +9,6 @@ class GetStartEndDate:
|
||||
|
||||
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',
|
||||
@ -19,6 +18,7 @@ class GetStartEndDate:
|
||||
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():
|
||||
@ -27,9 +27,7 @@ class GetStartEndDate:
|
||||
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)
|
||||
@ -41,6 +39,8 @@ class GetStartEndDate:
|
||||
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()
|
||||
@ -62,7 +62,6 @@ class GetStartEndDate:
|
||||
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),
|
||||
@ -72,6 +71,7 @@ class GetStartEndDate:
|
||||
'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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user