Module: Html2rss::Html::ArticleRules::Date
- Defined in:
- lib/html2rss/html/article_rules/date.rb
Overview
DOM-agnostic datetime aggregation for article published_at.
Constant Summary collapse
- MAX_DATE_CHARS =
Skip DateTime.parse above this length (Ruby parse is not a validator).
Description::MAX_DATE_CHARS
- OFFSET =
Trailing offset / Zulu marker — present means the string already has a zone.
/(?:Z|[+-]\d{2}:?\d{2})\z/i- AMBIGUOUS_DST =
Prefer standard time when a local clock time occurs twice (DST fall-back).
false
Class Method Summary collapse
-
.earliest(datetime_strings, leftover_lines: [], time_zone: 'UTC') ⇒ DateTime?
Earliest successfully parsed instant.
Class Method Details
.earliest(datetime_strings, leftover_lines: [], time_zone: 'UTC') ⇒ DateTime?
Returns earliest successfully parsed instant.
25 26 27 28 29 30 31 32 |
# File 'lib/html2rss/html/article_rules/date.rb', line 25 def earliest(datetime_strings, leftover_lines: [], time_zone: 'UTC') values = Array(datetime_strings).filter_map { |value| parse_attr(value, time_zone:) } Array(leftover_lines).each do |line| parsed = parse_line(line, time_zone:) values << parsed if parsed end values.min end |