2019-10-31 21:30:19 -04:00
|
|
|
import { autoUpdatingRelativeAge } from "discourse/lib/formatter";
|
2020-05-06 18:06:14 -04:00
|
|
|
import { htmlSafe } from "@ember/template";
|
2019-10-31 21:30:19 -04:00
|
|
|
|
2024-01-15 06:52:19 -05:00
|
|
|
export default function formatUnixDate(timestamp) {
|
2019-10-31 21:30:19 -04:00
|
|
|
if (timestamp) {
|
|
|
|
const date = new Date(moment.unix(timestamp).format());
|
|
|
|
|
2020-05-06 18:06:14 -04:00
|
|
|
return new htmlSafe(
|
2019-10-31 21:30:19 -04:00
|
|
|
autoUpdatingRelativeAge(date, {
|
|
|
|
format: "medium",
|
|
|
|
title: true,
|
2020-09-16 10:53:50 -04:00
|
|
|
leaveAgo: true,
|
2019-10-31 21:30:19 -04:00
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
2024-01-15 06:52:19 -05:00
|
|
|
}
|