tsentials-time
CommunityFreeze and test time without Date.now
Software Engineering#testing#deterministic#time#dependency-injection#utc#date-time-provider#fake-clock
Authorsenrecep
Version1.0.0
Installs0
System Documentation
What problem does it solve?
It solves nondeterministic tests and inconsistent timestamps caused by using Date.now() or new Date() directly in production code.
Core Features & Use Cases
- Testable time abstraction: Define a DateTimeProvider that your services depend on, so time is injectable and controllable.
- UTC-focused methods: Use utcNow(), utcNowDate(), and utcNowMs() to keep behavior consistent and time-zone safe.
- Deterministic fake clock for tests: Use createFakeDateTimeProvider to freeze time, advance time, and set an exact moment for assertions.
Quick Start
In your service, inject SystemDateTimeProvider for production behavior and inject createFakeDateTimeProvider for deterministic tests.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: tsentials-time Download link: https://github.com/senrecep/tsentials/archive/main.zip#tsentials-time Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.