From: "kouji (Kouji Takao)" Date: 2022-01-29T06:08:25+00:00 Subject: [ruby-core:107338] [Ruby master Bug#18514] ruby 2.6.9's Date#jisx0301 does not support Reiwa Issue #18514 has been updated by kouji (Kouji Takao). > Can you confirm with date-2.0.3 ? Thank you so much. I tried it, then I get good result! ---------------------------------------- Bug #18514: ruby 2.6.9's Date#jisx0301 does not support Reiwa https://bugs.ruby-lang.org/issues/18514#change-96235 * Author: kouji (Kouji Takao) * Status: Closed * Priority: Normal * Assignee: hsbt (Hiroshi SHIBATA) * ruby -v: ruby 2.6.9p207 (2021-11-24 revision 67954) [x86_64-darwin20] * Backport: 2.6: REQUIRED, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- In ruby 2.6.9 (ruby 2.6.9p207 (2021-11-24 revision 67954) [x86_64-darwin20]). $ ruby -rdate -e 'p Date.new(2019, 5, 1).jisx0301' => "H31.05.01" In ruby 2.6.6 and 2.7.5. => "R01.05.01" ruby 2.6.9's Date#jisx0301does not support Reiwa. https://github.com/ruby/ruby/blob/8e26731f9ef529009928628ba4b79fd2454e8e2d/ext/date/date_core.c#L7193 However, ruby 2.6.8's supports Reiwa. https://github.com/ruby/ruby/blob/768423edc2634574d66f14f3c2d3602326bfb464/ext/date/date_core.c#L7046 diff ``` --- 2.6.8.c 2022-01-26 10:42:49.000000000 +0900 +++ 2.6.9.c 2022-01-26 10:43:57.000000000 +0900 @@ -19,14 +19,10 @@ c = 'S'; s = 1925; } - else if (d < 2458605) { + else { c = 'H'; s = 1988; } - else { - c = 'R'; - s = 2018; - } snprintf(fmt, size, "%c%02ld" ".%%m.%%d", c, FIX2INT(y) - s); return fmt; } ``` So, I think it's a degradation. -- https://bugs.ruby-lang.org/ Unsubscribe: