2024-01-06 22:11:43 +00:00
|
|
|
const locale = 'en-GB'; // change this to your locale if you want a different date/time format
|
|
|
|
|
2024-01-05 11:53:44 +00:00
|
|
|
module.exports = function (eleventyConfig) {
|
2024-01-06 22:11:43 +00:00
|
|
|
eleventyConfig.addFilter('dateDisplay', date => new Date(date).toLocaleDateString(locale, {
|
2024-01-05 11:53:44 +00:00
|
|
|
"dateStyle": "short"
|
|
|
|
}));
|
|
|
|
|
2024-01-06 22:11:43 +00:00
|
|
|
eleventyConfig.addFilter('dateTimeDisplay', date => new Date(date).toLocaleString(locale, {
|
2024-01-05 11:53:44 +00:00
|
|
|
'dateStyle': 'short',
|
|
|
|
'timeStyle': 'short',
|
2024-01-06 22:11:43 +00:00
|
|
|
'hourCycle': 'h12'
|
2024-01-11 19:54:55 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
eleventyConfig.addFilter('toDate', date => new Date(date));
|
2024-01-05 11:53:44 +00:00
|
|
|
}
|