🌳 Tree-shakable |
📦 Zero runtime dependencies |
🧪 No global monkey-patching |
🛡️ Type-safe |
⏱️ Deterministic timers |
🕓 Four clock strategies |
🌍 Real timezone support (when applicable) |
🔌 Bring your own date library |
🧩 Modular & Extensible
Solid clock. Own time. Better tests.
Why monkey-patch the global clock to test your code?
Why rewrite the same time interface to inject it?
What if that interface doubled as your fake timers?
What if it were also type-safe and thoroughly tested?
Time-Provider is that interface: ready to use, fully deterministic in tests, and several times faster than Jest or Sinon fake timers.
Bring your own date library, and extend it with addons!
Philosophy
Time is scoped per call site: no global patch, no restore or cleanup step.
Time-Provider makes time an explicit, injectable dependency: a single object exposing a clock, a converter, a scheduler, and timings, swappable per call site.
Note: Non baseline or additional features are available as addons.
Features
Four clock strategies: system, manual, sequential and fixed - same API for production and tests.
Time flow and wall clock steps: make time flow, simulate a host sleep or a wall-clock correction. Also step from timer to timer.
Deterministic timers: driven by the clock strategy and run synchronously.
Bring your own date library: multiple date library plugins are available. Your code keeps working with the date type it already uses.
Timezone support: backed by the underlying library of your choice.
Tree-shakable: no deterministic runtimes bundled when not imported.
Manual and sequential clocks run synchronously. A due timer callback fires in-line, as a direct side effect of the call that made it due (and not on a real event-loop tick). This is what makes them deterministic without await, but it also means call ordering can differ subtly from a real async run.
Addons vs. Plugins
Within the scope of this library, these two terms refer to different concepts.
A plugin is essentially an adapter. It allows you to connect your preferred date library to the Time-Provider core library without adding any new functionality. Its sole purpose is to bridge the two libraries.
An addon, as the name suggests, extends the library by introducing new functionality or enhancing existing facades.
The npm package @time-provider/core receives a total of 15 weekly downloads. As such, @time-provider/core popularity was classified as not popular.
We found that @time-provider/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 1 open source maintainer collaborating on the project.
Cursor removed a malicious Claude Code 2.1.313 extension from its marketplace. Socket examines registry records and the initial claims about its distribution.