Created
February 26, 2025 21:54
-
-
Save zachleat/9f725bcc945d0123392bb7181874a728 to your computer and use it in GitHub Desktop.
Change default time zone for string dates in Eleventy
This file contains 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
import { DateTime } from "luxon"; | |
export default function(eleventyConfig) { | |
// requires Eleventy v3.0+ | |
eleventyConfig.addDateParsing(function(dateValue) { | |
if(typeof dateValue === "string") { // override String dates | |
return DateTime.fromISO(dateValue, { zone: "America/Chicago" }); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment