13 lines
324 B
Python
13 lines
324 B
Python
from datetime import date
|
|
|
|
try:
|
|
import chinese_calendar as calendar
|
|
|
|
def is_holiday(d: date) -> bool:
|
|
return calendar.is_holiday(d)
|
|
|
|
except Exception:
|
|
# Fallback: treat weekends as holidays if library unavailable
|
|
def is_holiday(d: date) -> bool: # type: ignore[misc]
|
|
return d.weekday() >= 5
|