Hwaro::Utils::DateUtils
Constants
Formats accepted by parse_lenient. Zone-bearing formats come
FIRST: Crystal's Time.parse ignores trailing input, so a zone-less
pattern would happily match 2026-07-01T10:00:00+09:00, silently
drop the +09:00, and shift the instant by the whole offset.
Importers additionally accept minute-precision, slash and RFC 822
dates (and prose dates, see parse_import) — what Jekyll, Hexo and Astro accept in front matter.
The minute-precision formats must precede the bare %Y-%m-%d (the
last CONTENT_FORMATS entry): it ignores trailing input, so it matched
2024-01-15 10:30 and silently dropped the time.
Prose dates (July 8, 2022, and Jul 08 2022 from Astro's blog
template, a JS Date string). Tried only on input shaped like
Month D YYYY: unguarded, %B %d %Y read May 2022 as day 20 of
the year 22.
Instance methods
The build's front-matter date parser. Format selection is based on the string's shape to avoid exception-based control flow; zone-less values are interpreted in the machine's local zone.
The importers' parser: parse_lenient over IMPORT_FORMATS, then the
guarded prose formats.