Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/coadler/rs-humanize
A Rust version of https://github.com/dustin/go-humanize
https://github.com/coadler/rs-humanize
Last synced: 2 months ago
JSON representation
A Rust version of https://github.com/dustin/go-humanize
- Host: GitHub
- URL: https://github.com/coadler/rs-humanize
- Owner: coadler
- License: mit
- Created: 2020-01-26T22:19:04.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-05T04:34:02.000Z (about 2 years ago)
- Last Synced: 2024-10-13T18:08:20.156Z (3 months ago)
- Language: Rust
- Size: 23.4 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rs-humanize
[![Crates.io](https://img.shields.io/crates/v/rs-humanize.svg)](https://crates.io/crates/rs-humanize)
[![docs.rs badge](https://docs.rs/rs-humanize/badge.svg)](https://docs.rs/rs-humanize)This is a Rust port of [go-humanize](https://github.com/dustin/go-humanize).
Right now only `humanize.Time` is ported over but I plan to do the rest.## Time
This lets you take a `DateTime` and spit it out in relative terms. For
example, `12 seconds ago` or `3 days from now`.Code example:
```rust
use rs_humanize::time;
use chrono::Utc;println!("{}", time::format(Utc::now()));
println!("{}", time::format(Utc.ymd(2018, 2, 18).and_hms(8, 30, 0)));
```