Skip to content

Converts between Japanese calendar and western calendar.

License

Notifications You must be signed in to change notification settings

ebc-2in2crc/wareki

Repository files navigation

English | 日本語

wareki

CI MIT License GoDoc Go Report Card Version

wareki converts between Japanese calendar and western calendar.

Description

wareki converts between Japanese calendar and western calendar.

When converting from the Western calendar to the Japanese calendar, the era of the Japanese calendar is automatically determined according to the Western calendar. The year of Western calendar can be omitted and the default value is the system date.

By default, the Japanese era is output with one uppercase letter (e.g. R) but can also be output with kanji (e.g. 令和) You can also convert from Japanese calendar to Western calendar by specifying an option.

wareki support Reiwa, Heisei, Taisho, Meiji.

Usage

$ date "+%Y/%m/%d"
2019/05/01

$ wareki
R1

$ wareki --kanji
令和1

$ wareki 2018
H30

$ wareki 2019/05/01
R1

$ wareki 2019/04/30
H31

$ wareki --reiwa 1
2019

$ wareki --heisei 1
1989

$ wareki --heisei 1
1989

$ wareki --showa 1
1926

$ wareki --help
# ...

Or, you can use Docker.

$ date "+%Y/%m/%d"
2019/05/01

$ docker container run --rm ebc2in2crc/wareki
R1

$ docker container run --rm ebc2in2crc/wareki --kanji
令和1

Installation

Developer

Go 1.16 or later.

$ go install github.com/ebc-2in2crc/wareki/cmd/wareki@latest

Go 1.15.

$ go get -u github.com/ebc-2in2crc/wareki/...

User

Download from the following url.

Or, you can use Homebrew (Only macOS).

$ brew tap ebc-2in2crc/wareki
$ brew install wareki

Or, you can use Docker.

$ docker pull ebc2in2crc/wareki
$ docker container run ebc2in2crc/wareki
R4

Contribution

  1. Fork this repository
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Rebase your local changes against the master branch
  5. Run test suite with the go test ./... command and confirm that it passes
  6. Run gofmt -s
  7. Create new Pull Request

License

MIT

Author

ebc-2in2crc