Skip to content

Commit

Permalink
Adjusting date format (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcelestino authored Oct 21, 2024
1 parent 0f86f60 commit 6f0972f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
const { DateTime } = require('luxon');
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');

module.exports = (eleventyConfig) => {
eleventyConfig.addPassthroughCopy('assets');
eleventyConfig.addFilter('readableDate', (dateObj) => {
return DateTime.fromJSDate(dateObj)
.setLocale('pt')
.toFormat('d LLLL yyyy')
.toUpperCase();
const date = new Date(dateObj);
date.setMinutes(date.getMinutes() + date.getTimezoneOffset());
return date.toLocaleString('pt-BR', {
day: 'numeric',
month: 'long',
year: 'numeric',
});
});
eleventyConfig.addPlugin(syntaxHighlight);
return {
Expand Down

0 comments on commit 6f0972f

Please sign in to comment.