szurubooru/client/js/util/handlebars-helpers.js

16 lines
405 B
JavaScript
Raw Normal View History

2016-04-05 17:57:26 +02:00
'use strict';
const handlebars = require('handlebars');
const misc = require('./misc.js');
2016-04-06 22:34:21 +02:00
handlebars.registerHelper('reltime', function(time) {
2016-04-05 17:57:26 +02:00
return new handlebars.SafeString(
2016-04-06 22:34:21 +02:00
'<time datetime="' + time + '" title="' + time + '">' +
misc.formatRelativeTime(time) +
2016-04-05 17:57:26 +02:00
'</time>');
});
2016-04-06 22:34:21 +02:00
handlebars.registerHelper('toLowerCase', function(str) {
return str.toLowerCase();
});