workclock
A maintained, correct replacement for an unmaintained business-time library, with one Rust core shared by Rust, Python and JavaScript.
- Role
- Author and maintainer
- When
- October 2026
- Stack
- Rust, jiff, Python (PyO3), WebAssembly, TypeScript
The problem
Business-time arithmetic sounds simple: when is a ticket with an 8-hour SLA due, or how many contracted hours fell inside a shift? It gets hard with overnight shifts, holidays and time zones. At Getin Solutions I worked on exactly this kind of problem, with shifts that run past midnight.
The usual Python library for it, businesstimedelta, has had no release since 2019, and its bugs are still open: overnight shifts count as zero hours, queries past the last holiday crash, and holidays in a different time zone can loop forever.
What I did
- Wrote the core in Rust on top of jiff, and exposed it to Python through PyO3 and to JavaScript through WebAssembly, so all three languages share one implementation.
- Ported businesstimedelta’s API and test suite as a compatibility layer: most existing code runs unchanged with one import change, and a migration guide lists where workclock intentionally differs.
- Specified every rule with examples in a design document, and checked each binding against a brute-force reference implementation with property-based tests.
- Handled the details that bite in production: daylight-saving time resolved the way RFC 5545 and JavaScript Temporal do, bounded searches, signed differences, and time zone data bundled with the Python and npm packages.
- Published it on crates.io, PyPI and npm, with a docs site and an in-browser playground.
Outcome
workclock fixes the overnight-shift, holiday and time zone bugs, and it is much faster: in benchmarks run in CI, 620× faster than businesstimedelta for a year-long span with bank holidays, and 280× faster across a million pairs.
It’s pre-1.0, so the API may still change in a minor release.