Migrating from luxon-business-days
The translations below are checked against the real luxon-business-days in test/luxon-business-days.test.ts.
Unless you configure other holidays, luxon-business-days skips seven US shipping holidays. These rules give the same holidays, which the tests check for every day from 1900 to 2200:
ts
import { DateTime } from 'luxon-business-days';
import { addWorkdays, createWorkCalendar } from 'temporal-workdays';
const shippingHolidays = [
'01-01',
{ easter: 0 },
{ month: 5, dayOfWeek: 1, week: -1 }, // Memorial Day
'07-04',
{ month: 9, dayOfWeek: 1, week: 1 }, // Labor Day
{ month: 11, dayOfWeek: 4, week: 4 }, // Thanksgiving
'12-25',
];
const calendar = createWorkCalendar({ holidays: shippingHolidays });
DateTime.fromISO('2026-11-25').plusBusiness({ days: 1 }).toISODate(); // → '2026-11-27'
calendar.addWorkdays(Temporal.PlainDate.from('2026-11-25'), 1).toString(); // → '2026-11-27'| luxon-business-days | temporal-workdays |
|---|---|
dt.setupBusiness({ businessDays, holidayMatchers }), which is global | createWorkCalendar({ weekend, holidays }), with no global state |
businessDays: [1, 2, 3, 4, 5] | weekend: [6, 7], the other days. Both number Monday as 1. |
dt.plusBusiness({ days: n }), dt.minusBusiness(…) | addWorkdays(d, n), subtractWorkdays(d, n) |
dt.isBusinessDay() | !isWeekend(d), because it checks only the weekday and not holidays |
dt.isBusinessDay() && !dt.isHoliday() | isWorkday(d) |
dt.isHoliday() | isHoliday(d) |
availableHolidayMatchers.isMLKDay, isColumbusDay and the others | rules such as { month: 1, dayOfWeek: 1, week: 3 } and { month: 10, dayOfWeek: 1, week: 2 } |
a custom holiday matcher (dt) => boolean | holidays: (date) => boolean, which receives a Temporal.PlainDate |
| no equivalent | workdaysBetween, workdaysInMonth, working hours, observed holidays |