From e1bb277fb44abe7d473bfa04b1d602f496be5e96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Tue, 9 May 2023 13:24:15 -0400 Subject: [PATCH] feat: add helper to convert isostrings to localeString --- public/src/modules/helpers.common.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/src/modules/helpers.common.js b/public/src/modules/helpers.common.js index e424d650b6..32a8665f4e 100644 --- a/public/src/modules/helpers.common.js +++ b/public/src/modules/helpers.common.js @@ -28,6 +28,7 @@ module.exports = function (utils, Benchpress, relative_path) { generateRepliedTo, generateWrote, register, + isoTimeToLocaleString, __escape: identity, }; @@ -337,6 +338,10 @@ module.exports = function (utils, Benchpress, relative_path) { return `[[topic:wrote-${langSuffix}, ${relative_path}/post/${post.pid}, ${post.timestampISO}]]`; } + function isoTimeToLocaleString(isoTime) { + return new Date(isoTime).toLocaleString().replace(/,/g, ','); + } + function register() { Object.keys(helpers).forEach(function (helperName) { Benchpress.registerHelper(helperName, helpers[helperName]);