This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/helpers/format-age.js
2020-03-12 13:29:55 -04:00

13 lines
410 B
JavaScript

import { autoUpdatingRelativeAge, durationTiny } from "discourse/lib/formatter";
import { registerUnbound } from "discourse-common/lib/helpers";
import { htmlSafe } from "@ember/template";
registerUnbound("format-age", function(dt) {
dt = new Date(dt);
return htmlSafe(autoUpdatingRelativeAge(dt));
});
registerUnbound("format-duration", function(seconds) {
return htmlSafe(durationTiny(seconds));
});