mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
12 lines
400 B
JavaScript
12 lines
400 B
JavaScript
import { autoUpdatingRelativeAge, durationTiny } from 'discourse/lib/formatter';
|
|
import { registerUnbound } from 'discourse-common/lib/helpers';
|
|
|
|
registerUnbound('format-age', function(dt) {
|
|
dt = new Date(dt);
|
|
return new Handlebars.SafeString(autoUpdatingRelativeAge(dt));
|
|
});
|
|
|
|
registerUnbound('format-duration', function(seconds) {
|
|
return new Handlebars.SafeString(durationTiny(seconds));
|
|
});
|