date-now

A requirable version of Date.now()

7 个版本
安装
npm install date-now
yarn add date-now
pnpm add date-now
bun add date-now
README

date-now

build status

browser support

A requirable version of Date.now()

Use-case is to be able to mock out Date.now() using require interception.

Example

var now = require("date-now")

var ts = now()
var ts2 = Date.now()
assert.equal(ts, ts2)

example of seed

var now = require("date-now/seed")(timeStampFromServer)

// ts is in "sync" with the seed value from the server
// useful if your users have their local time being a few minutes
// out of your server time.
var ts = now()

Installation

npm install date-now

Contributors

  • Raynos

MIT Licenced

版本列表
1.0.1 2014-06-11
1.0.0 2014-04-09
0.1.4 2013-02-09
0.1.3 2013-01-29
0.1.2 2013-02-09
0.1.1 2013-01-27
0.1.0 2013-01-23