3 releases (breaking)

✓ Uses Rust 2018 edition

0.3.0 Jan 12, 2020
0.2.0 Apr 1, 2019
0.1.0 Jan 14, 2019

#8 in #japanese

26 downloads per month

Custom license

7KB
80 lines

erajp

Japanese era converter for Rust.

Inspired by mattn/go-erajp.

Examples

Convert a year to Japanese era.

assert_eq!(Some("令和"), erajp::to_era_from_year(2019));

Convert a day to Japanese era (using chrono)

extern crate chrono;
use chrono::prelude::*;

let today = Local::today();
assert_eq!(Some("平成"), erajp::to_era(&today));

License

MIT

Author

Tomochika Hara (a.k.a. thara)


lib.rs:

era-jp

converter for Japanese era

Examples

a year to Japanese era

# extern crate erajp;
assert_eq!(Some("令和"), erajp::to_era_from_year(2019));

a day to Japanese era

# extern crate erajp;
extern crate chrono;
use chrono::prelude::*;

let today = Local::today();
assert_eq!(Some("令和"), erajp::to_era(&today));

Dependencies

~4MB
~64K SLoC