DateUtils
Constants
The three HTTP date shapes (RFC 1123, RFC 850, asctime)
Front matter dates are almost always one of a few fixed shapes. These are tried first, in local time when the string carries no zone (matching what Cronic assumed for them). Cronic's natural language parser is roughly 10,000 times slower than a strict format parse (about 2.5ms per date), and every post's date used to go through it on the main thread before any task could start.
Time::Format#parse accepts a matching prefix and ignores the rest, so each pattern is guarded by an anchored regex of its exact shape.
Zone offsets a formatter accepts: -14:00 .. +14:00. Anything wider would raise from Time::Location rather than fail to parse.
RFC 2822 ("Wed, 02 Oct 2002 13:00:00 GMT"), day name optional
YAML parses unquoted date: 2020-02-02 into a Time, and the
front matter loader stringifies it with Time#to_s, so these two
shapes ("2020-02-02 00:00:00 UTC", "2020-02-02 10:30:00 -03:00")
are what most posts actually carry
ISO 8601 / RFC 3339 with a zone designator (Z or ±hh:mm) and an optional fractional second
Class methods
Fixed-format parsers, cheapest and most common first. Every
formatter is guarded by an anchored regex of the exact shape it
handles, because Time::Format#parse accepts a matching prefix and
ignores whatever follows. Returns nil when no shape matches or the
matched text is not a valid date (month 13, 25:00), in which case
parse falls through to the natural language parser.
Public so specs can prove a shape stays on this path.