date-since
v1.0.0
Published
format a javascript date into seconds, hours, days, or years ago
Downloads
3
Readme
Date Since
Parses a javascript date and turns it into a "x time ago" format where time can be seconds, minutes, hours, days, or years.
example
> import dateSince from 'date-since'
> const time = new Date()
> console.log(dateSince(time))
2 seconds ago
methods
import dateSince from 'date-since';
dateSince(date)
returns a string that formats the date into the aforementioned format.
install
With npm do:
npm install date-since