pub fn readable_diff<Tz: TimeZone>(
start: &DateTime<Tz>,
end: &DateTime<Tz>,
) -> Option<String>Expand description
Format the elapsed time between two timestamps.
Pass both arguments in the same zone to count whole years on that zone’s
calendar. Return None for a negative elapsed time.
§Example:
use chrono::prelude::*;
use imessage_database::util::dates::readable_diff;
let start = Utc.with_ymd_and_hms(2020, 5, 20, 9, 10, 11).unwrap();
let end = Utc.with_ymd_and_hms(2020, 5, 20, 9, 15, 13).unwrap();
assert_eq!(readable_diff(&start, &end).unwrap(), "5 minutes, 2 seconds");