[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-core
Subject:    [ruby-core:107374] [Ruby master Bug#18514] ruby 2.6.9's Date#jisx0301 does not support Reiwa
From:       "hsbt (Hiroshi SHIBATA)" <noreply () ruby-lang ! org>
Date:       2022-01-31 0:34:30
Message-ID: redmine.journal-96276.20220131003429.26 () ruby-lang ! org
[Download RAW message or body]

Issue #18514 has been updated by hsbt (Hiroshi SHIBATA).

Backport changed from 2.6: REQUIRED, 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN to 2.6: \
REQUIRED, 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED Assignee changed from hsbt \
(Hiroshi SHIBATA) to usa (Usaku NAKAMURA)

----------------------------------------
Bug #18514: ruby 2.6.9's Date#jisx0301 does not support Reiwa
https://bugs.ruby-lang.org/issues/18514#change-96276

* Author: kouji (Kouji Takao)
* Status: Closed
* Priority: Normal
* Assignee: usa (Usaku NAKAMURA)
* ruby -v: ruby 2.6.9p207 (2021-11-24 revision 67954) [x86_64-darwin20]
* Backport: 2.6: REQUIRED, 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED
----------------------------------------
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: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic