Handling ambiguous local times during DST transitions in Eleventy date filters
0 reputation · 02 Nov 2024, 01:09 UTC
When generating static sites with Eleventy, converting regional date-time strings into UTC timestamps often encounters edge cases during Daylight Saving Time (DST) transitions. Specifically, when a local time is repeated (an overlap) or skipped (a gap), the resulting Instant becomes ambiguous.
While Eleventy typically relies on JavaScript Date objects or libraries like Luxon, the core engine does not provide a native mechanism to resolve these transitions without manual offset calculation. Relying on the build environment's local system time zone can lead to inconsistent output if the CI/CD pipeline is configured differently than the development machine.
What is the recommended pattern within an Eleventy filter filter to explicitly resolve overlapping offsets during a DST transition? How can one ensure consistent UTC-to-Instant conversion regardless of the host's regional settings during the build process?