#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

#537 in Date and time

Download history 47/week @ 2024-02-29 79/week @ 2024-03-07 43/week @ 2024-03-14 55/week @ 2024-03-21 70/week @ 2024-03-28 81/week @ 2024-04-04 103/week @ 2024-04-11 137/week @ 2024-04-18 98/week @ 2024-04-25 87/week @ 2024-05-02 37/week @ 2024-05-09 54/week @ 2024-05-16 42/week @ 2024-05-23 38/week @ 2024-05-30 41/week @ 2024-06-06 25/week @ 2024-06-13

157 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