Expand description
Given a Duration, lossily format it like in ‘N days ago’.
Parsing it back to Duration is not supported yet (See chrono-english
crate).
Multiple languages are supported though Language
trait.
Enable isolang
feature to gain support of getting Language impl from
lsolang::Language
.
You can configure minimum and maximum time units, as well as “precision” of how many items to emit.
Fractional results like “1.5 days ago” are not supported.
There is a special simplified version to get compact 5-character representation: format_5chars
.
The main item of timeago is Formatter
.
Re-exports
pub use languages::from_isolang;
pub use languages::english::English;
Modules
A collection of natural languages supported out-of-the-box for the formatting.
Structs
Main formatter struct. Build it with new() and maybe modify some options, then use convert.
Enums
Simple formatting style for deprecated format
.
Various units of time to specify as maximum or minimum. Note that calculations are approximate, not calendar-based.
Traits
Interface for connecting natural languages to use for the formatting See “language” module documentation for details.
Functions
Do the formatting. See Style
’s docstring for formatting options.
If you need just simple mode without bloated featureful implementation,
use version 0.0.2 of this crate
A simplified formatter, resulting in short strings like “02Yea” or “ now “ or “07min”. Designed to always give 5-character strings.
Type Definitions
Dynamic version of the Language
trait