module

Fetcher::TimeParser

RFC-compliant time parser for feed dates Supports RFC 2822 (RSS), RFC 3339/ISO 8601 (Atom, JSON Feed), and common variants. All parsed times are normalized to UTC to avoid location mismatches and ensure consistent comparison behavior.

Constants

FALLBACK_DATE_PATTERN = /\d{4}-\d{2}-\d{2}$/

Pre-compiled regexes to avoid repeated compilation in hot path

FALLBACK_DATETIME_PATTERN = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/

Class methods

normalize(time : Time | Nil) : Time | Nil

Normalize a Time to UTC. This ensures consistent location for comparisons (UTC vs +00:00 are equal after normalization).

Source
parse(time_str : String | Nil) : Time | Nil

Parse time from various feed date formats, returning UTC-normalized Time.

Source