Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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)));
```