datetime-diff

0.2.1 • Public • Published

DateTime diff

Small library that tells the difference between two dates in seconds, minutes, hours and days

Installation

$ npm install datetime-diff

Usage

var diff = require('datetime-diff');

Examples

var diff = require('datetime-diff');
var date1 = new Date(2016, 10, 1);
var date2 = new Date(2016, 10, 2);
var result = diff(date1, date2); // => { "seconds" : 86400, "minutes" : 1440, "hours" : 24, "days" : 1}
console.log(result.days); // => 1

Tests

$ npm test

Package Sidebar

Install

npm i datetime-diff

Weekly Downloads

1

Version

0.2.1

License

ISC

Last publish

Collaborators

  • czemuja