Created
February 14, 2024 08:37
-
-
Save gr36/312b2618815e234127db73c7a7175a33 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Add a date filter | |
| eleventyConfig.addFilter("dateFormat", function(date) { | |
| const year = date.getFullYear(); | |
| const month = ('0' + (date.getMonth() + 1)).slice(-2); // Adds leading 0 for single digit months | |
| const day = ('0' + date.getDate()).slice(-2); // Adds leading 0 for single digit days | |
| return `${year}/${month}/${day}`; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment