Socket
Socket
Sign inDemoInstall

date-now

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    date-now

A requirable version of Date.now()


Version published
Weekly downloads
1.2M
increased by3.93%
Maintainers
1
Install size
5.93 kB
Created
Weekly downloads
 

Package description

What is date-now?

The date-now npm package provides a simple utility for getting the current timestamp in milliseconds, similar to Date.now(). It is primarily used when you need a lightweight function to obtain the current date and time in a Node.js environment.

What are date-now's main functionalities?

Get current timestamp

This feature allows you to get the current timestamp in milliseconds. It is similar to using Date.now() in JavaScript but is provided as a standalone module that can be required in Node.js applications.

var dateNow = require('date-now');
var timestamp = dateNow();
console.log(timestamp);

Other packages similar to date-now

Readme

Source

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

FAQs

Last updated on 11 Jun 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc