diff-in-time
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Description

This project returns difference in time between two dates.

Installing

npm i diff-in-time

Example

Import the lib

const diffInTime = requier('diff-in-time');
import diffInTime from 'diff-in-time';

Call functions

const params = {
  firstTime: new Date('2020-05-7'),
  secondTime: new Date('2020-05-10'),
};

diffInTime.getDiffInSeconds(params); // 270000
diffInTime.getDiffInMinutes(params); // 4500
diffInTime.getDiffInHours(params); // 75
diffInTime.getDiffInDays(params); // 3.125
diffInTime.getDiffInWeeks(params); // 0.44642857142857145
diffInTime.getDiffInMonth(params); // 0.10080645161290322
diffInTime.getDiffInYears(params); // 0.008561643835616438

diffInTime.getDiffAll(params);
/*return {
  seconds: 270000,
  minutes: 4500,
  hours: 75,
  days: 3.125,
  weeks: 0.44642857142857145,
  months: 0.10080645161290322,
  years: 0.008561643835616438
}*/

Dependents (0)

Package Sidebar

Install

npm i diff-in-time

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

3.73 kB

Total Files

4

Last publish

Collaborators

  • alex.korotkov