aboutsummaryrefslogtreecommitdiffstats
path: root/ext/date/date_core.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-09 01:27:36 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-09 01:27:36 +0000
commit320c98b436b5277678907b9ba32e4c6cdd3678a0 (patch)
tree9ede4685aca051866e93d82752675d9b956dfd39 /ext/date/date_core.c
parent63e66f08b6b524aff2bce99e30ef4fb343b2fe30 (diff)
downloadruby-320c98b436b5277678907b9ba32e4c6cdd3678a0.tar.gz
date: support for Reiwa, new Japanese era
[Feature #15742] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/date/date_core.c')
-rw-r--r--ext/date/date_core.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/date/date_core.c b/ext/date/date_core.c
index b6f806ff1f..67ed6171a7 100644
--- a/ext/date/date_core.c
+++ b/ext/date/date_core.c
@@ -7039,10 +7039,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;
}