1
0
mirror of https://github.com/matt-fidd/stratos.git synced 2026-01-01 18:19:25 +00:00

Added handlebars format time helper

This commit is contained in:
2022-04-18 12:58:55 +00:00
parent 3242b401d3
commit ce00fd1835

View File

@@ -10,4 +10,24 @@ helpers.json = function (object) {
return JSON.stringify(object); return JSON.stringify(object);
}; };
helpers.formatTime = function (date) {
const dateOptions = {
day: '2-digit',
month: '2-digit',
year: 'numeric'
};
const timeOptions = {
hour12: false,
hour: '2-digit',
minute: '2-digit'
};
return (
date.toLocaleDateString('en', dateOptions) +
' ' +
date.toLocaleTimeString('en', timeOptions)
);
};
module.exports = helpers; module.exports = helpers;