Project

General

Profile

Actions

Bug #18514

closed

ruby 2.6.9's Date#jisx0301 does not support Reiwa

Added by kouji (Kouji Takao) almost 3 years ago. Updated over 2 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.6.9p207 (2021-11-24 revision 67954) [x86_64-darwin20]
[ruby-core:107280]

Description

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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0