Back to browse
GitHub Repository

TypeScript library for injecting time and timers with adapters for multiple date libraries.

0 starsTypeScript

Injectable time and timers with custom Date types for TypeScript

by jaenyf·Jul 27, 2026·1 point·0 comments

AI Analysis

●●SolidNiche GemBig Brain

Scoped time injection beats jest.useFakeTimers() global patching.

Strengths
  • Four clock strategies (system, fixed, manual, sequential) share a single API.
  • Zero runtime dependencies keeps the bundle size minimal.
  • Type-safe adapters let you bring your own date library.
Weaknesses
  • New project with zero stars suggests unproven stability in production.
  • Temporal API adoption might make this pattern native soon.
Target Audience

TypeScript developers writing testable code

Similar To

jest · sinon · fake-timers

Post Description

I find TypeScript js/node environment is missing a Time-Provider (just like *.*NET TimeProvider for instance ships with its framework).

So for this purpose I built a small library (@time-provider) tailored for js/node environment.

Obviously the goal is to both avoid using global monkey-patching with fake-timers or re-writing your clock interface... and still use your date library (native or custom).

I propose four clock strategies: system (real time), fixed manual (advance time explicitly), and sequential (replay of a sequence of timestamps).

I also benchmarked slightly better performances than jest / sinon.

The project is still young, so the API may still receive refinements as real usage appears.

I would be happy to hear feedback on this ! Take care.

You can check it out on GitHub: https://github.com/jaenyf/time-provider

Jaenyf

Similar Projects

AI/ML●●●Banger

Gremlin

Human-in-the-loop agent injection with WebGPU models running entirely in-browser.

WizardryZero to OneCozy
aosmith
222mo ago
Security●●Solid

LLM AuthZ Audit – find auth gaps and prompt injection in LLM apps

Purpose-built LLM security linter covers OWASP Top 10, but static analysis has inherent blind spots.

Big BrainSolve My Problem
iamspathan
105mo ago