chronomancer
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

chronomancer

Manipulates the global Date object; useful for tests.

Installation

Get it via npm:

npm install --save chronomancer

Usage

import { freezeDate, resetDate } from 'chronomancer'
 
freezeDate('2017-01-31')        // Accepts whatever the Date() constructor can parse
 
const frozen = 1517356800000    // => 2018-01-31 in UNIX epoch time
assert(Date.now(), frozen)
assert(Date.now(), frozen)
 
resetDate()                     // Resets the global Date object
assert(Date.now(), frozen)      // This will throw AssertionError (unless you've figured out time travel)

Readme

Keywords

Package Sidebar

Install

npm i chronomancer

Weekly Downloads

1

Version

1.0.4

License

Apache-2.0

Unpacked Size

28.6 kB

Total Files

16

Last publish

Collaborators

  • kevincharm