mirror of
https://github.com/flarum/framework.git
synced 2024-11-24 18:41:10 +08:00
19 lines
449 B
JavaScript
19 lines
449 B
JavaScript
import humanTimeUtil from 'flarum/utils/humanTime';
|
|
|
|
function updateHumanTimes() {
|
|
$('[data-humantime]').each(function() {
|
|
const $this = $(this);
|
|
const ago = humanTimeUtil($this.attr('datetime'));
|
|
|
|
$this.html(ago);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* The `humanTime` initializer sets up a loop every 1 second to update
|
|
* timestamps rendered with the `humanTime` helper.
|
|
*/
|
|
export default function humanTime() {
|
|
setInterval(updateHumanTimes, 10000);
|
|
}
|