we've batted this idea around a couple times in Discord but haven't prioritized it yet.
the idea is to provide dates in UTC and progressively enhance them with a localized date.
in the abstract, here's some ideas that have been mention and i've batted around:
Markup
<time datetime="1914-12-20T08:00">
JS
* get all `datetime` on page: document.querySelectorAll('[datetime]')
* replace node children with `new Date(elementDatetimeUTCDate).toLocaleString('en-US', options);`
Approach
I don't think we have to get fancy.
This script could be added in src/js and linked with a <script async> tag in the templates that need it.
we've batted this idea around a couple times in Discord but haven't prioritized it yet.
the idea is to provide dates in UTC and progressively enhance them with a localized date.
in the abstract, here's some ideas that have been mention and i've batted around:
Markup
JS
Approach
I don't think we have to get fancy. This script could be added in
src/js
and linked with a<script async>
tag in the templates that need it.Note, we'll need to add a
addPassthroughCopy
to.eleventy.js
: https://github.com/LunchDevCommunity/community-calendar/blob/main/.eleventy.js#L49-L51I think this would be a totally decent first step toward this goal.
/cc @rstacruz @BenDMyers @msutkowski