Skip to main content

Crate whenparse

Crate whenparse 

Source
Expand description

Parse natural-language dates and times (English + Russian) into jiff types.

use jiff::Zoned;
use whenparse::{parse_with, When};

let now = Zoned::now();
assert!(matches!(parse_with("next friday", &now), Ok(When::Date(_))));
assert!(matches!(parse_with("через 2 недели", &now), Ok(When::Date(_))));
assert!(matches!(parse_with("2h30m", &now), Ok(When::Duration(_))));

Structs§

Options

Enums§

Dialect
Lang
ParseError
When

Functions§

parse
Parse input relative to the anchor now. The anchor is always explicit so results are deterministic and testable.
parse_with
Convenience wrapper over parse with default Options.