#duration #human #chrono #formatting #format

chrono-human-duration

Simple human formatting of chrono::Duration

2 releases

0.1.1 Jan 24, 2020
0.1.0 Jan 24, 2020

#412 in Date and time

Download history 74/week @ 2024-07-29 38/week @ 2024-08-05 84/week @ 2024-08-12 36/week @ 2024-08-19 55/week @ 2024-08-26 135/week @ 2024-09-02 124/week @ 2024-09-09 178/week @ 2024-09-16 166/week @ 2024-09-23 92/week @ 2024-09-30 90/week @ 2024-10-07 106/week @ 2024-10-14 171/week @ 2024-10-21 108/week @ 2024-10-28 363/week @ 2024-11-04 215/week @ 2024-11-11

864 downloads per month
Used in 3 crates (2 directly)

Apache-2.0/MIT

4KB
67 lines

chrono-human-duration

Very small crate for format durations for humans.

Example

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");

Dependencies

~1MB
~18K SLoC