README.md in japanese_calendar-0.3.2 vs README.md in japanese_calendar-0.4.0
- old
+ new
@@ -21,55 +21,58 @@
## Usage
To get the Japanese era name, use the `era_name` method:
```
+Time.new(2019, 5, 1).era_name # => "令和"
Time.new(1989, 1, 8).era_name # => "平成"
Time.new(1926, 12, 25).era_name # => "昭和"
Time.new(1912, 7, 30).era_name # => "大正"
Time.new(1873, 1, 1).era_name # => "明治"
```
If you want to get the Japanese era name in romaji, pass `:romaji`:
```
+Time.new(2019, 5, 1).era_name(:romaji) # => "Reiwa"
Time.new(1989, 1, 8).era_name(:romaji) # => "Heisei"
Time.new(1926, 12, 25).era_name(:romaji) # => "Showa"
Time.new(1912, 7, 30).era_name(:romaji) # => "Taisho"
Time.new(1873, 1, 1).era_name(:romaji) # => "Meiji"
```
You can convert to a Japanese year with the `era_year` method:
```
-Time.new(2016, 12, 11).era_year # => 28
+Time.new(2019, 5, 1).era_year # => 1
+Time.new(2019, 4, 30).era_year # => 31
Time.new(1989, 1, 7).era_year # => 64
Time.new(1926, 12, 24).era_year # => 15
Time.new(1912, 7, 29).era_year # => 45
```
To get a string representation of the Japanese calendar, use the `strftime` method:
```
-time = Time.new(1989, 1, 1)
+time = Time.new(2019, 5, 1)
# Japanese era
-time.strftime("%K") # => "平成"
-time.strftime("%O") # => "Heisei"
-time.strftime("%^O") # => "HEISEI"
-time.strftime("%o") # => "H"
-time.strftime("%J") # => "01"
-time.strftime("%-J") # => "1"
-time.strftime("%_J") # => " 1"
+time.strftime("%JN") # => "令和"
+time.strftime("%JR") # => "Reiwa"
+time.strftime("%^JR") # => "REIWA"
+time.strftime("%Jr") # => "R"
+time.strftime("%Jy") # => "01"
+time.strftime("%-Jy") # => "1"
+time.strftime("%_Jy") # => " 1"
# Japanese weekday name
-time.strftime("%Q") # => "日曜日"
-time.strftime("%q") # => "日"
+time.strftime("%JA") # => "水曜日"
+time.strftime("%Ja") # => "水"
# More examples
-time.strftime("%K%-J年%-m月%-d日(%q)") # => "平成1年1月1日(日)"
-time.strftime("%o%J.%m.%d") # => "H01.01.01"
-time.strftime("%B %-d, %-Y (%O %-J)") # => "January 1, 1989 (Heisei 1)"
+time.strftime("%JN%-Jy年%-m月%-d日(%Ja)") # => "令和1年5月1日(水)"
+time.strftime("%Jr%Jy.%m.%d") # => "R01.05.01"
+time.strftime("%B %-d, %-Y (%JR %-Jy)") # => "May 1, 2019 (Reiwa 1)"
```
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.