use anyhow::Context; use chrono::NaiveDate; // very basic org mode date parser pub fn parse_org_date(s: &str) -> anyhow::Result<NaiveDate> { let s = s.strip_prefix('<').context("Invalid date")?; let s = s.strip_suffix('>').context("Invalid date")?; let s = s.rsplit_once(' ').context("Invalid date")?.0; Ok(NaiveDate::parse_from_str(s, "%Y-%m-%d")?) }