A module for calculating the duration between two given dates, irrespective of the order.
If you have npm installed
$ npm install duration-calculator
Inside a js file:
var durationCalculator = require('duration-calculator'); var duration = durationCalculator.calculate(date1, date2); console.log('Duration = ' + duration);
Duration calculator works with Day Light Saving hours too. Tests are in place in test.js. Thanks to Ollie Buck for contributing. Current version in now available from npm.