Compare The Data Difference Between Two Dates – js-time-diff

Category: Date & Time , Javascript | July 26, 2018
Author: santanup
Views Total: 691
Official Page: Go to website
Last Update: July 26, 2018
License: MIT

Preview:

Compare The Data Difference Between Two Dates – js-time-diff

Description:

js-time-diff is a JavaScript library that compares the difference between two dates and outputs the human-friendly relative dates and times.

How to use it:

Install and import the js-time-diff library.

# NPM
$ npm install js-time-diff --save
import TimeDiff from 'js-time-diff';

Or include the compiled and minified version of the js-time-diff library in the html.

<script src="dist/time-diff.min.js" >

Compare two dates/times:

TimeDiff('12-25-17', '07-16-18');

This will output:

7 months ago

You Might Be Interested In:


Leave a Reply