#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

#44 in #human

Download history 172/week @ 2023-12-18 133/week @ 2023-12-25 27/week @ 2024-01-01 95/week @ 2024-01-08 100/week @ 2024-01-15 44/week @ 2024-01-22 88/week @ 2024-02-05 49/week @ 2024-02-12 146/week @ 2024-02-19 95/week @ 2024-02-26 40/week @ 2024-03-04 78/week @ 2024-03-11 54/week @ 2024-03-18 45/week @ 2024-03-25 110/week @ 2024-04-01

293 downloads per month
Used in 2 crates (via surrealdb-migrations)

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