rss_gen::data

Function parse_date

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

Parses a date string into a DateTime.

§Arguments

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

§Returns

  • Ok(DateTime) if the date is valid and successfully parsed.
  • Err(RssError) if the date is invalid or cannot be parsed.

§Errors

This function returns an Err(RssError::DateParseError) if the date cannot be parsed into a valid DateTime.

§Panics

This function will panic if the “UTC” time zone is invalid, but this is highly unlikely as “UTC” is always valid.