Repository navigation
Migrating from businesstimedelta
Karthik P edited this page Oct 25, 2026
·
3 revisions
Most code migrates with one line:
import workclock.compat as businesstimedeltaworkclock.compat mirrors businesstimedelta 1.0.1: WorkDayRule, LunchTimeRule, HolidayRule, Rules and BusinessTimeDelta, with the same arguments, defaults and operators. businesstimedelta's own test suite runs against it in CI.
What changes for existing code:
-
Fixed: overnight shifts,
TypeErrorpast the last holiday (#8, #10), infinite loops with holidays in another zone (#9), time off that starts inside a working period, and searches that never end. -
Different on purpose: results come back in the
tzinfoyou passed in; negative deltas move the other way; times repeated at the end of DST resolve to their first occurrence; holidays on DST days last 23 or 25 hours; python-holidays objects are read once for 1970–2100; customRulesubclasses and nestedRulesraiseTypeError.
MIGRATING.md has the full list with examples.
For new code, the typed workclock.Schedule API is smaller and stricter: it rejects naive datetimes, returns a signed between (#12) and has batch methods for lists and NumPy arrays. See Getting Started.
workclock is MIT licensed. The repository documentation is authoritative; this wiki summarises it.