feat: add helper to convert isostrings to localeString

This commit is contained in:
Barış Soner Uşaklı
2023-05-09 13:24:15 -04:00
parent c65c2aafd7
commit e1bb277fb4

View File

@@ -28,6 +28,7 @@ module.exports = function (utils, Benchpress, relative_path) {
generateRepliedTo, generateRepliedTo,
generateWrote, generateWrote,
register, register,
isoTimeToLocaleString,
__escape: identity, __escape: identity,
}; };
@@ -337,6 +338,10 @@ module.exports = function (utils, Benchpress, relative_path) {
return `[[topic:wrote-${langSuffix}, ${relative_path}/post/${post.pid}, ${post.timestampISO}]]`; return `[[topic:wrote-${langSuffix}, ${relative_path}/post/${post.pid}, ${post.timestampISO}]]`;
} }
function isoTimeToLocaleString(isoTime) {
return new Date(isoTime).toLocaleString().replace(/,/g, ',');
}
function register() { function register() {
Object.keys(helpers).forEach(function (helperName) { Object.keys(helpers).forEach(function (helperName) {
Benchpress.registerHelper(helperName, helpers[helperName]); Benchpress.registerHelper(helperName, helpers[helperName]);