2018-11-25 18:33:59 +00:00
|
|
|
import { format } from '../_thirdparty/timeago/timeago'
|
2018-11-25 09:20:58 +00:00
|
|
|
import { mark, stop } from '../_utils/marks'
|
|
|
|
|
2019-05-26 23:01:14 +00:00
|
|
|
export function formatTimeagoDate (date, now) {
|
2018-11-25 09:20:58 +00:00
|
|
|
mark('formatTimeagoDate')
|
2019-05-26 23:01:14 +00:00
|
|
|
// use Math.max() to avoid things like "in 10 seconds" when the timestamps are slightly off
|
|
|
|
let res = format(date, Math.max(now, date))
|
2018-11-25 09:20:58 +00:00
|
|
|
stop('formatTimeagoDate')
|
|
|
|
return res
|
|
|
|
}
|