1.0.3 • Published 3 years ago

aging v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

aging.js

This library provides a function to calculate a difference between two dates. 0 dependencies, unit tests.

Installation

npm i aging

Usage

import dateDiff from 'aging';

const from = new Date(2019, 2, 22, 10, 15, 40, 350);
const to = new Date(2021, 3, 25, 12, 20, 50, 800);
const diff = dateDiff(from, to);
console.log(diff);
// {
//   years: 2,
//   months: 1,
//   days: 3,
//   hours: 2,
//   minutes: 5,
//   seconds: 10,
//   milliseconds: 450
// }

Important thing about this lib is that you will always get a positive diff: if from date is coming after the to date, they will be swapped before diff calculation.

Contribution

  • Clone this repo
  • Run npm install
  • Add stuff you want
  • Add tests
  • Submit pull request
1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago