JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1216333
  • Score
    100M100P100Q181928F

A requirable version of Date.now()

Package Exports

  • date-now

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (date-now) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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