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