17 lines
400 B
JavaScript
17 lines
400 B
JavaScript
import { htmlSafe } from "@ember/template";
|
|
import { autoUpdatingRelativeAge } from "discourse/lib/formatter";
|
|
|
|
export default function formatUnixDate(timestamp) {
|
|
if (timestamp) {
|
|
const date = new Date(moment.unix(timestamp).format());
|
|
|
|
return new htmlSafe(
|
|
autoUpdatingRelativeAge(date, {
|
|
format: "medium",
|
|
title: true,
|
|
leaveAgo: true,
|
|
})
|
|
);
|
|
}
|
|
}
|