Repository

jaenyf/time-provider

time-provider

Your single time interface for all your JavaScript / TypeScript projects.

0stars

Open github.com

jaenyf/time-provider

time-provider

Injectable time and timer provider for JavaScript and TypeScript with support for multiple clock strategies and date libraries.

Visit project

Show me a random project

First shared
Jul 27, 2026
HN activity
20

Show HN@jaenyfJul 27, 2026

Show HN: Injectable time and timers with custom Date types for TypeScript

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

Community

Hacker News discussion

Loading the thread…