I Got Tired of Hardcoding Mexico's Holidays
Published on 2026-09-17
In almost every app that deals with schedules, payments, deliveries or reports, the same small problem eventually appears: is this date a working day in Mexico?
I used to solve it by hardcoding Mexico's holidays inside the app. It was only a couple of lines, so creating a package felt unnecessary. Then the same couple of lines appeared in another project, and then another one. Every team had to remember which holidays move to Monday, which ones do not, and when that list needed to be updated.
That was enough reason for my team and me to build mexico-holidays.
A small package for a small problem
The package calculates Mexico's predictable mandatory rest days under Article 74 of the Federal Labor Law. It does not keep a giant list of dates for every year. The movable holidays are calculated from their rules, so you can ask about 2026, 2027 or a later year without updating the package every January.
Install it with:
npm install mexico-holidays
Then you can check a date directly:
import { isHoliday, isBusinessDay } from "mexico-holidays";
isHoliday("2026-09-16"); // true
isBusinessDay("2026-09-16"); // false
isBusinessDay("2026-09-17"); // true
You can also get the complete holiday list for a year. Each item includes the date, its English and Spanish names, and the corresponding Article 74 reference:
import { getHolidays } from "mexico-holidays";
const holidays = getHolidays(2027);
What about Holy Week and weekends?
Good Friday and Holy Saturday are commonly observed in Mexico, but they are not federal mandatory-rest days under Article 74. I did not want the package to quietly mix custom with law, so Holy Week is optional:
isBusinessDay("2027-03-26", {
includeHolyWeek: true
}); // false
Saturdays and Sundays are treated as non-working days by default. If your operation works on one or both, you can define that too:
isBusinessDay("2027-02-07", {
weekendDays: ["saturday"]
}); // true: Sunday is a working day for this schedule
isBusinessDay("2027-02-07", {
weekendDays: []
}); // true: weekends are ignored
Why publish a couple of lines?
Because the difficult part was never writing an if. It was making the same decision repeatedly, checking the law again, handling movable dates, testing edge cases and keeping every app consistent.
Not every package needs to be a framework. Sometimes it can just remove one boring thing from the next project. If your app needs to know whether a date is a working day in Mexico, you can now install the answer instead of hardcoding it again.
The package is MIT licensed. You can see the full API and source code on GitHub.