diff options
Diffstat (limited to 'ext/date/date_core.c')
-rw-r--r-- | ext/date/date_core.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/ext/date/date_core.c b/ext/date/date_core.c index 918e61234c..1734ec0349 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -4755,6 +4755,10 @@ date_s__jisx0301(int argc, VALUE *argv, VALUE klass) * * Date.jisx0301('H13.02.03') #=> #<Date: 2001-02-03 ...> * + * For no-era year, legacy format, Heisei is assumed. + * + * Date.jisx0301('13.02.03') #=> #<Date: 2001-02-03 ...> + * * Raise an ArgumentError when the string length is longer than _limit_. * You can stop this check by passing `limit: nil`, but note that * it may take a long time to parse. @@ -7190,10 +7194,14 @@ jisx0301_date_format(char *fmt, size_t size, VALUE jd, VALUE y) c = 'S'; s = 1925; } - else { + else if (d < 2458605) { c = 'H'; s = 1988; } + else { + c = 'R'; + s = 2018; + } snprintf(fmt, size, "%c%02ld" ".%%m.%%d", c, FIX2INT(y) - s); return fmt; } @@ -8358,6 +8366,11 @@ datetime_s_httpdate(int argc, VALUE *argv, VALUE klass) * DateTime.jisx0301('H13.02.03T04:05:06+07:00') * #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...> * + * For no-era year, legacy format, Heisei is assumed. + * + * DateTime.jisx0301('13.02.03T04:05:06+07:00') + * #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...> + * * Raise an ArgumentError when the string length is longer than _limit_. * You can stop this check by passing `limit: nil`, but note that * it may take a long time to parse. |