use super::funejson::Value; use super::dates_add_days::epoch_day_from_iso; /// Calendar days from one date to another: end minus start, negative when the /// end is earlier. Both dates are parsed strictly, so an impossible date fails /// rather than being rolled into the next month. /// /// # Panics /// Panics if either date is malformed or impossible. pub fn days_between(start_iso: &str, end_iso: &str) -> i64 { epoch_day_from_iso(end_iso) - epoch_day_from_iso(start_iso) } pub fn fune_vector(args: &[Value]) -> Value { Value::Int(days_between(args[0].as_str(), args[1].as_str())) }