commenthol / date-holidays

worldwide holidays
https://commenthol.github.io/date-holidays/
Other
918 stars 238 forks source link

Unsetting rule breaks isHoliday function. #484

Open rodrialbanese opened 2 weeks ago

rodrialbanese commented 2 weeks ago

Have to modify some AR holidays, but doing so, I got an error checking isHoliday() My code:

import Holidays from "date-holidays"

const holidays = new Holidays("AR")

holidays.unsetRule("12-31 12:00")
holidays.unsetRule("12-24 12:00")
holidays.setHoliday("12-31")
holidays.setHoliday("12-24")

console.log(holidays.isHoliday("2024-12-31"))

The error: Uncaught TypeError: Cannot read properties of undefined (reading 'inYear') at Holidays2._dateByRule (date-holidays.js?v=b7d6f4cb:14782:28) at Holidays2.isHoliday (date-holidays.js?v=b7d6f4cb:14620:33) at fechaVencimiento.js:13:77