Crates.io | chrono-human-duration |
lib.rs | chrono-human-duration |
version | 0.1.1 |
source | src |
created_at | 2020-01-24 16:37:56.297782 |
updated_at | 2020-01-24 16:48:08.997339 |
description | Simple human formatting of chrono::Duration |
homepage | |
repository | https://github.com/derekdreery/chrono-human-duration |
max_upload_size | |
id | 201567 |
size | 3,731 |
Very small crate for format durations for humans.
use chrono_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::minutes(20);
assert_eq!(d.format_human().to_string(), "just now");