npm.io
1.0.0 • Published 5 years ago

whendys

Licence
MIT
Version
1.0.0
Deps
0
Size
12 kB
Vulns
0
Weekly
0

when, never why

Whendys is a small library used to get the time since a Date represented in an edible readable format.

"8 hours ago"

Example

import {when} from 'whendys'

// pretend it's June 23, 2021!

// String
let delay = when('June 26, 2020') // => 11 months ago

// Date object
delay = when(new Date('June 22 2021'))  // => 1 day ago

// Milliseconds
delay = when(1623643200000) // => 1 week ago