How to remove custom holidays
masterIf you no longer need a custom holiday checker, you can remove it using the unregister method. This prevents the custom logic from affecting subsequent holiday checks.
from jpholiday import JPHoliday, OriginalHolidayCheckerInterface
import datetime
jpholiday = JPHoliday()
class TestHoliday(OriginalHolidayCheckerInterface):
def is_holiday(self, date):
if date == datetime.date(2020, 2, 9):
return True
return False
def holiday_name(self, date):
return '特別休暇'
checker = TestHoliday()
jpholiday.register(checker)
# Remove the custom holiday
jpholiday.unregister(checker)
print(jpholiday.is_holiday(datetime.date(2020, 2, 9))) # False