pub struct ParseCfg {
pub parse: Option<Vec<String>>,
pub mode: Mode,
pub order: Order,
pub lang: Lang,
pub to_lower: bool,
pub relative: bool,
pub ref_time: Option<Dt>,
}Fields§
§parse: Option<Vec<String>>Explicit list of formats to try in the exact order given.
If this is provided and the vec is non-empty and the mode is Explicit
then only these formats are tried and mode and order are ignored.
If the mode is not Explicit then after trying the formats in parse the
rest of the parser will continue as normal, using mode and order.
Example:
parse: ["%Y-%m-%d", "%d/%m/%Y", "%m/%d/%Y", "%d.%m.%Y"]mode: ModeControls which preset format sets are used (astronomy/scientific formats, legacy business rules, etc.).
order: OrderControls ambiguous numeric dates.
lang: LangSets language to use, not persistent.
to_lower: boolWhether to lowercase the input:
ONLY set to false if the &str is already lowercase.
relative: boolWhether to parse relative dates as well as normal dates.
ref_time: Option<Dt>Reference (“current”) time used for relative expressions:
-
“tomorrow”, “next Friday”, “in 3 days”, “next week”
-
dates missing a year/month (“March 15”, “15th of next month”)
-
If
Some(tp), thisDtis used as “now” (overrides everything). -
If
None+stdfeature enabled: automatically uses real system time. -
If
None+ nostd: parsing relative dates will fail with a clear error.