Time manipulation library: Control and modify time effortlessly for testing, animations, or creative projects.
npm install time-titansh
npm i time-titan
`
via yarn:
`sh
yarn add time-titan
`
Usage
`js
import TimeTitan from 'time-titan';
const titi = new TimeTitan();
// Freeze time
titi.freeze();
// Unfreeze time
titi.unfreeze();
// Set a specific timestamp
titi.setTime(1700000000000);
// Jump forward or backward in time
titi.warp(10000); // Move 10 seconds ahead
// Accelerate time (2x speed)
titi.accelerate(2);
// Decelerate time (0.5x speed, half-speed)
titi.decelerate(0.5);
// Reset time to normal behavior
titi.reset();
// Mock a specific date
titi.mockDate('2025-12-31T23:59:59Z');
// Pause and resume time
titi.pause();
titi.resume();
// Loop time between two timestamps
titi.loop(1700000000000, 1700000100000, 2);
// Save and restore time checkpoints
const checkpoint = titi.saveCheckpoint();
titi.restoreCheckpoint(checkpoint);
`
API Reference
$3
Stops time at the current moment, making Date.now() return the same value until unfreezed.
$3
Resumes normal time flow.
$3
Overrides Date.now() with a fixed timestamp.
$3
Moves time forward or backward by the specified number of milliseconds.
$3
Makes time run faster by a given multiplier (e.g., 2 makes time run twice as fast).
$3
Slows down time by a given fraction (e.g., 0.5 makes time run at half speed).
$3
Restores Date.now()` to its normal behavior.