Crates.io | basic-human-duration |
lib.rs | basic-human-duration |
version | 0.2.0 |
source | src |
created_at | 2020-12-10 23:45:43.353074 |
updated_at | 2023-04-09 19:15:44.260836 |
description | Simple human formatting of chrono::Duration |
homepage | |
repository | https://github.com/SmailBarkouch/chrono-human-duration |
max_upload_size | |
id | 321678 |
size | 5,863 |
A very small crate to format durations for humans.
In comparison to the original repo...
use basic_human_duration::ChronoHumanDuration;
use chrono::Duration;
let d = Duration::weeks(2) + Duration::days(3);
assert_eq!(d.format_human().to_string(), "2 weeks ago");
let d = Duration::seconds(20);
assert_eq!(d.format_human().to_string(), "just now");