Closed paulrobertlloyd closed 1 year ago
Deno' std modules include some datetime utils, like this parser; https://deno.land/std@0.157.0/datetime/mod.ts?s=parse but it doesn't auto-detect the format. Maybe the date-fns library (a already used dependency) can handle these formats.
I like also the git related dates of Eleventy. It's something that @dz4k implemented in his site: https://github.com/dz4k/denizaksimsek.com/blob/master/_build/get-dates-from-git.ts
Pages can only include dates in the following formats:
2021-01-01
2021-01-01 03:10:10
2021-01-01 03:10:10 -0700
This appears to follow RFC 3339. However, IS0 8601 dates typically don’t include spaces, but instead use
T
to separate the date and time. For example, the above can also be represented as:2021-01-01
2021-01-01T03:10:10Z
2021-01-01Y03:10:10-0700
Support for this representation in Lume would be useful as it would make migrating pages from an Eleventy-powered blog easier. For reference, Eleventy supports thew following date formats:
It should be noted that Luke’s date format filters support both of the above representations (
ATOM
andDATETIME
).ISO 8601 dates also don’t need to include
-
or:
separators, so the following dates are also valid:20210101
20210101T031010Z
20210101Y031010-0700
There may be less need to support this, although I’be come across it on my own site where I’m parsing iCalendar data which formats dates using this representation. As I can’t use them directly when generating pages, I need to manipulate them to the format Lume allows.