1.0.4 • Published 6 years ago

chronomancer v1.0.4

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
6 years ago

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)
1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago