mirror of
https://github.com/matt-fidd/stratos.git
synced 2026-01-01 18:19:25 +00:00
34 lines
580 B
JavaScript
34 lines
580 B
JavaScript
'use strict';
|
|
|
|
const helpers = {};
|
|
|
|
helpers.eq = function (arg1, arg2, options) {
|
|
return arg1 === arg2 ? options.fn(this) : options.inverse(this);
|
|
};
|
|
|
|
helpers.json = function (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-GB', dateOptions) +
|
|
' ' +
|
|
date.toLocaleTimeString('en-GB', timeOptions)
|
|
);
|
|
};
|
|
|
|
module.exports = helpers;
|