[−][src]Function bloguen::util::parse_date_format_specifier
pub fn parse_date_format_specifier(spec: &str) -> Option<Cow<[TimeFormatItem]>>
Parse a datetime specifier in the format_output()
argument style.
A couple presets are accepted:
The standard strftime()
syntax,
but wrapped in "
s.
Examples
assert_eq!(parse_date_format_specifier("rfc_2822"), Some(vec![Item::Fixed(Fixed::RFC2822)].into())); assert_eq!(parse_date_format_specifier("RFC3339"), Some(vec![Item::Fixed(Fixed::RFC3339)].into())); assert_eq!(parse_date_format_specifier("\"%Y %B %d\""), Some(StrftimeItems::new("%Y %B %d").collect())); assert!(parse_date_format_specifier("epoch").is_none());