API Reference

Returns the relative time difference of two dates

function relativeTimeDiff(to: Date, from: Date = new Date())

// Example:

const fiveMinutesAgo = new Date(Date.now() - 60 * 1000 * 5)
 
relativeTimeDiff(fiveMinutesAgo) //=> "5 minutes ago"