Skip to main content

parse_date

Function parse_date 

Source
pub fn parse_date(date_str: &str) -> Result<OffsetDateTime>
Expand description

Parses a date string into a time::OffsetDateTime.

Accepts both RFC 2822 (the historical RSS 2.0 wire format — Mon, 01 Jan 2024 00:00:00 GMT / … +0000 / … +0530) and ISO 8601 (2024-01-01T00:00:00Z, used by Atom and Dublin Core). The previous implementation collapsed every successfully-parsed date to a UTC sentinel; this revision returns the actual parsed value so callers can inspect the timezone offset and the exact instant.

§Arguments

  • date_str - A string slice that holds the date to parse.

§Errors

Returns RssError::DateParseError when the input matches neither RFC 2822 nor ISO 8601.