Save 37% off PRO during our Black Friday Sale! »

From ㍻ to U+32FF

66342ecb106aed81b83d9fb608d73c92?s=47 MITSUMITSU
April 19, 2019

From ㍻ to U+32FF

@RubyKaigi 2019

66342ecb106aed81b83d9fb608d73c92?s=128

MITSUMITSU

April 19, 2019
Tweet

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 *quoted from wikipedia

  6. 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
  7. Schedule New Japanese era name Announced April May Golden Week

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

  9. How our system use Japanese era 2019 Tax Office

  10. How our system use Japanese era 2019 Tax Office 平成31

  11. How our system use Japanese era Bank Other Company 2019

    Tax Office 平成31
  12. How our system use Japanese era Bank Other Company 2019

    Tax Office 平成31 平成31
  13. How our system use Japanese era Bank Other Company 2019

    Tax Office 平成31 H.31 平成31
  14. How our system use Japanese era Bank Other Company 2019

    Tax Office 平成31 h31 平成31 H.31
  15. 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)
  16. 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
  17. Pattern 2. Japanese era -> Christian era - Examples: -

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

    平成31年04月30日 -> 2019/04/30 - 令和01年05月01日 -> 2019/05/01 - 平成31年05月01日 -> ???
  19. 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
  20. 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
  21. 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.
  22. 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
  23. 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).
  24. 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 (令和)”
  25. 3. Refactor the code: the original code

  26. 3. Refactor the code: if statement part

  27. 3. Refactor the code: add Reiwa to RE?

  28. 3. Refactor the code: add Reiwa to RE? Only for

    Heisei (平成)
  29. 3. Refactor the code: add elsif statement for Reiwa?

  30. 3. Refactor the code: After 1

  31. 3. Refactor the code: After 2

  32. 3. Refactor the code: After final

  33. 4. Make the code compatible with “Reiwa(令和)”

  34. 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!!