mirror of
https://github.com/matt-fidd/stratos.git
synced 2026-01-01 20:59:30 +00:00
Added handlebars format time helper
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user