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/initializers/relative-ages.js.es6

20 lines
412 B
JavaScript

import { updateRelativeAge } from "discourse/lib/formatter";
// Updates the relative ages of dates on the screen.
export default {
name: "relative-ages",
initialize() {
this._interval = setInterval(function() {
updateRelativeAge($(".relative-date"));
}, 60 * 1000);
},
teardown() {
if (this._interval) {
clearInterval(this._interval);
this._interval = null;
}
}
};