
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







