Gathering detailed insights and metrics for chronokinesis
Gathering detailed insights and metrics for chronokinesis
Gathering detailed insights and metrics for chronokinesis
Gathering detailed insights and metrics for chronokinesis
npm install chronokinesis
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
10 Stars
62 Commits
1 Forks
1 Watchers
2 Branches
1 Contributors
Updated on Mar 20, 2025
Latest Version
6.0.0
Package Id
chronokinesis@6.0.0
Unpacked Size
23.12 kB
Size
5.28 kB
File Count
7
NPM Version
6.14.18
Node Version
14.21.3
Published on
Aug 09, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Mock time and date for traveling and freezing. Inspired and borrowed from timekeeper.
Mock Date
and Date.now
in order to help you test time-dependent code. Provides travel
, freeze
, and timezone functionality for your Node.js tests.
1import * as ck from 'chronokinesis'; 2 3ck.freeze(); 4 5setTimeout(() => { 6 // Frozen 7 console.log(new Date()); 8 9 ck.reset(); 10}, 2000);
or use with moment
:
1import moment from 'moment'; 2import * as ck from 'chronokinesis'; 3 4ck.travel(moment().add(1, 'year')); 5 6setTimeout(() => { 7 // Date traveled one year and some 8 console.log(new Date()); 9 10 ck.reset(); 11}, 2000);
freeze([...args])
Freeze point in time. Calls can be made with the same arguments as the Date
constructor.
...args
: Optional date constructor arguments, if empty stops time at now1import * as ck from 'chronokinesis'; 2 3ck.freeze('1942-01-08'); 4 5setTimeout(() => { 6 // Frozen 7 console.log(new Date()); 8 9 ck.reset(); 10}, 2000);
travel([...args])
Time travel to another era. Calls can be made with the same arguments as the Date
constructor
...args
: Optional date constructor arguments, pretty useless if empty but won´t crash1import * as ck from 'chronokinesis'; 2let date = new Date(2018, 0, 31); 3 4ck.travel(date); 5 6setTimeout(function() { 7 console.log(new Date()); 8 ck.reset(); 9}, 1500);
When used in combination with freeze
the time is still frozen but at the travelled time().
1import * as ck from 'chronokinesis'; 2import moment from 'moment'; 3 4let date = new Date(2018, 0, 31); 5 6ck.freeze(date); 7 8ck.travel(moment().add(1, 'year')); 9 10setTimeout(function() { 11 console.log(`Still frozen but one year ahead ${new Date()}`); 12 13 ck.reset(); 14}, 1500);
defrost()
Defrost a frozen point in time. Used in combination with travelling will start ticking the clock.
1import * as ck from 'chronokinesis'; 2 3ck.freeze(1980, 0, 1); 4 5// Travel one year 6ck.travel(1981, 1, 1); 7 8// Start ticking 9ck.defrost(); 10 11setTimeout(() => { 12 // Tick tack 13 console.log(new Date()); 14 15 ck.reset(); 16}, 2000);
reset()
Resets Date to current glory.
1import * as ck from 'chronokinesis'; 2 3ck.freeze(2060, 0, 1); 4console.log(`end of time is reached at ${new Date()} according to Newton`) 5 6ck.reset(); 7 8// Today 9console.log(new Date())
isKeepingTime()
Utility function to see if we still travel or freeze time.
1import * as ck from 'chronokinesis'; 2 3console.log(ck.isKeepingTime() ? 'Is' : 'Not', 'keeping time'); 4ck.travel(1893448800000); 5console.log(ck.isKeepingTime() ? 'Is' : 'Not', 'keeping time');
timezone(timeZone[, ...args])
Travel to time zone.
timeZone
: IANA time zone string...args
: Optional travel to date argumentsReturns TimeZoneTraveller
api
1import * as ck from 'chronokinesis'; 2 3const tz = ck.timezone('Asia/Shanghai'); 4 5// Now in Shanghai 6console.log(new Date()) 7 8tz.freeze();
new TimeZoneTraveller(timeZone)
Time zone traveller api.
1import {TimeZoneTraveller} from 'chronokinesis'; 2 3const timezone = new TimeZoneTraveller('Asia/Shanghai'); 4 5timezone.freeze();
timezone.freeze([...args])
Freeze at the specific timezone.
timezone.travel([...args])
Start traveling in the specific timezone.
timezone.reset()
Same as #reset
timezone.defrost()
Same as #defrost
The module is prepared for browser and nodejs.
1const ck = require('chronokinesis');
Use dist/chronokinesis.cjs
. Sets global property chronokinesis
.
chronokinesis initial code is inspired and borrowed from timekeeper
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 0/28 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More