#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

#422 in Date and time

Download history 71/week @ 2024-07-27 40/week @ 2024-08-03 81/week @ 2024-08-10 41/week @ 2024-08-17 39/week @ 2024-08-24 130/week @ 2024-08-31 88/week @ 2024-09-07 193/week @ 2024-09-14 195/week @ 2024-09-21 87/week @ 2024-09-28 90/week @ 2024-10-05 113/week @ 2024-10-12 145/week @ 2024-10-19 116/week @ 2024-10-26 356/week @ 2024-11-02 188/week @ 2024-11-09

815 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