1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//! Relative-time formatting.
//!
//! This module builds on [`crate::duration`] and shares the same locale-aware
//! configuration surface through [`crate::DurationOptions`].
pub use AgoDisplay;
use crate;
use crate;
/// Creates a human-readable relative-time formatter using default options.
///
/// # Examples
///
/// ```rust
/// let elapsed = core::time::Duration::from_secs(3661);
/// assert_eq!(humfmt::ago(elapsed).to_string(), "1h 1m ago");
/// ```
/// Creates a human-readable relative-time formatter with custom duration options.
///
/// # Examples
///
/// ```rust
/// use humfmt::DurationOptions;
///
/// let elapsed = core::time::Duration::from_millis(1500);
/// let out = humfmt::ago_with(elapsed, DurationOptions::new().long_units());
/// assert_eq!(out.to_string(), "1 second 500 milliseconds ago");
/// ```