Skip to content

Instantly share code, notes, and snippets.

@zachleat
Created February 26, 2025 21:54
Show Gist options
  • Save zachleat/9f725bcc945d0123392bb7181874a728 to your computer and use it in GitHub Desktop.
Save zachleat/9f725bcc945d0123392bb7181874a728 to your computer and use it in GitHub Desktop.
Change default time zone for string dates in Eleventy
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