fn try_parse_rfc_850(time: &str) -> Option<PrimitiveDateTime> {
    let dt = PrimitiveDateTime::parse(time, "%A, %d-%b-%y %H:%M:%S").ok()?;

    // If the `time` string contains a two-digit year, then as per RFC 2616 § 19.3,
    // we consider the year as part of this century if it's within the next 50 years,
    // otherwise we consider as part of the previous century.

    let now = OffsetDateTime::now_utc();
    let century_start_year = (now.year() / 100) * 100;
    let mut expanded_year = century_start_year + dt.year();

    if expanded_year > now.year() + 50 {
        expanded_year -= 100;
    }

    let date = Date::try_from_ymd(expanded_year, dt.month(), dt.day()).ok()?;
    Some(PrimitiveDateTime::new(date, dt.time()))
}
/// Attempt to parse a `time` string as a RFC 850 formatted date time string.
///
/// Eg: `Wednesday, 11-Jan-21 13:37:41 UTC`
Attempt to parse a `time` string as a RFC 850 formatted date time string.
Attempt to parse a ` time ` string as a RFC 850 formatted date time string .
fn try_parse_rfc_850(time: &str) -> Option<PrimitiveDateTime> {
    let dt = PrimitiveDateTime::parse(time, "%A, %d-%b-%y %H:%M:%S").ok()?;
    // If the `time` string contains a two-digit year, then as per RFC 2616 § 19.3,
    // we consider the year as part of this century if it's within the next 50 years,
    // otherwise we consider as part of the previous century.
    let now = OffsetDateTime::now_utc();
    let century_start_year = (now.year() / 100) * 100;
    let mut expanded_year = century_start_year + dt.year();
    if expanded_year > now.year() + 50 {
        expanded_year -= 100;
    }
    let date = Date::try_from_ymd(expanded_year, dt.month(), dt.day()).ok()?;
    Some(PrimitiveDateTime::new(date, dt.time()))
}
fn try_parse_rfc_850 ( time : & str ) -> Option < PrimitiveDateTime > { let dt = PrimitiveDateTime :: parse ( time , " " ) . ok ( ) ? ; // If the `time` string contains a two-digit year, then as per RFC 2616 § 19.3, // we consider the year as part of this century if it's within the next 50 years, // otherwise we consider as part of the previous century. let now = OffsetDateTime :: now_utc ( ) ; let century_start_year = ( now . year ( ) / 100 ) * 100 ; let mut expanded_year = century_start_year + dt . year ( ) ; if expanded_year > now . year ( ) + 50 { expanded_year -= 100 ; } let date = Date :: try_from_ymd ( expanded_year , dt . month ( ) , dt . day ( ) ) . ok ( ) ? ; Some ( PrimitiveDateTime :: new ( date , dt . time ( ) ) ) }
Attempt to parse a `time` string as a RFC 850 formatted date time string.
Attempt to parse a ` time ` string as a RFC 850 formatted date time string .
time
&str
time
&str