3 releases (breaking)

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

#294 in Internationalization (i18n)

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

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

a day to Japanese era

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

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

Dependencies

~2.7–4MB
~59K SLoC