Upgrade to Pro — share decks privately, control downloads, hide ads and more …

From ㍻ to U+32FF

MITSUBOSHI
April 19, 2019

From ㍻ to U+32FF

@RubyKaigi 2019

MITSUBOSHI

April 19, 2019
Tweet

More Decks by MITSUBOSHI

Other Decks in Technology

Transcript

  1. From ㍻ to U+32FF From ㍻ to U+32FF From ㍻

    to U+32FF From ㍻ to U+32FF MITSUBOSHI Yuya
  2. From ㍻ to U+32FF From ㍻ to U+32FF From ㍻

    to U+32FF From ㍻ to MITSUBOSHI Yuya
  3. Self-Introduction MITSUBOSHI Yuya (三星祐也) - GitHub: @MITSUBOSHI - Twitter: @Y_MITSUBOSHI

    - Working for Money Forward, inc. - Born in Heisei (平成) 5
  4. 2019 is a Big Year for Accounting Software in Japan

    - Change of Gengo (Japanese Era Name) - 平成(Heisei) -> 令和(Reiwa) - From 2019/05: less than half a month left - Change of Consumption Tax Rate - 8% -> 10% and multiple tax rates (+ reduced tax rate) will be introduced - From 2019/10: still more than 5 months left
  5. What gengo is: briefly - Gengo is one of the

    year numbering system used in Japan - It is convertible to Christian Era (Heisei 31 -> 2019) - Gengo changes when the Emperor changes
  6. Schedule New Japanese era name Announced April May Golden Week

    1st 27 6 18 20 RubyKaigi 2019 Reiwa (令和) Heisei (平成)
  7. How our system use Japanese era Bank Other Company 2019

    Tax Office 平成31 h31 平成31 H.31
  8. Patterns of usage of Japanese era - Pattern 1. Christian

    era (Our System) -> Japanese era (Other System) - Pattern 2. Japanese era (Other System) -> Christian era (Our System)
  9. Pattern 1. Christian era -> Japanese era - Examples: -

    2019/04/30 -> 平成31年04月30日 - 2019/05/01 -> 令和01年05月01日 - We have only to care about the format of converted result (right-hand side) - That is because the original format (left-hand side) is stored in our DB as date type
  10. Pattern 2. Japanese era -> Christian era - Examples: -

    平成31年04月30日 -> 2019/04/30 - 令和01年05月01日 -> 2019/05/01
  11. Pattern 2. Japanese era -> Christian era - Examples: -

    平成31年04月30日 -> 2019/04/30 - 令和01年05月01日 -> 2019/05/01 - 平成31年05月01日 -> ???
  12. Pattern 2. Japanese era -> Christian era - Examples: -

    平成31年04月30日 -> 2019/04/30 - 令和01年05月01日 -> 2019/05/01 - 平成31年05月01日 -> 2019/05/01 #<- should be convertible
  13. Pattern 2. Japanese era -> Christian era - Examples: -

    平成31年04月30日 -> 2019/04/30 - 令和01年05月01日 -> 2019/05/01 - 平成31年05月01日 -> 2019/05/01 #<- should be convertible - 令和01年04月30日 -> 2019/04/30 #<- should be convertible
  14. Pattern 2. Japanese era -> Christian era - Examples: -

    平成31年04月30日 -> 2019/04/30 - 令和01年05月01日 -> 2019/05/01 - 平成31年05月01日 -> 2019/05/01 #<- should be convertible - 令和01年04月30日 -> 2019/04/30 #<- should be convertible - 令和元年05月01日 -> 2019/05/01 #<- should be convertible * “元年” means origin year. it’s used for year 1 of an era.
  15. Pattern 2. Requirements - 1. 令和{0,}1 #Kanji + half-width number

    - 2. 令和{0,}1 #Kanji + full-width number - 3. 令和元 #Kanji + 元年(origin year) - 4. R{0,}1 #Capital R without dot - 5. R.{0, 1} #Captial R with dot - 6. r.{0, 1} #samll r with dot - 7. 2019 #half-width number - 8. 2019 #full-width number - 9. Others (1~8 + some unnecessary characters or spaces may be included) *Needless to say, “平成”(the current Gengo) must be covered
  16. Ecosystem around Japanese era - Date#jisx0301 - Ruby 2.6.3 was

    released yesterday - gem “wareki” - gem “era_ja” - They are nice! But none of them satisfy all our system’s unique requirements (before I mentioned).
  17. All of our steps 1. Investigate the code which must

    be modified. 2. Add test codes 3. Refactor the code 4. Make the code compatible with “Reiwa (令和)”
  18. Conclusion - This talk was about the change of gengo

    and how our team dealt with it - The current Japanese era “Heisei (平成)” will end soon - Look forward to the new Japanese era “Reiwa (令和)” - We’re hiring!!