date 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/date/date_core.c +14 -1
- data/ext/date/date_parse.c +8 -4
- data/lib/date.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5fd26f10cea9d0d9c0c9af53fdbec0b57f303ba90e1258be39a804d4d97e471
|
4
|
+
data.tar.gz: 612e53600f02e04d8058490c2f39dbf9deacc05af70dddcdbad1baba68491cb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ae8c570c323530065fbfb4d0423b1d178d77f3000ebcb1c0adb3586dd934d9f3f6fcc0385afca5897316a89950fcd4e0beb93c219ea168f1917fb2e7976ed7f
|
7
|
+
data.tar.gz: e7044003b3517172c98efc69b58bc5355a9562c017b88d0b520626f145aeda4780ad24b9c504e6ee0b5df12c4282c3998f6afc5c8e4d20fbdcfaf1badd574ea2
|
data/ext/date/date_core.c
CHANGED
@@ -4755,6 +4755,10 @@ date_s__jisx0301(int argc, VALUE *argv, VALUE klass)
|
|
4755
4755
|
*
|
4756
4756
|
* Date.jisx0301('H13.02.03') #=> #<Date: 2001-02-03 ...>
|
4757
4757
|
*
|
4758
|
+
* For no-era year, legacy format, Heisei is assumed.
|
4759
|
+
*
|
4760
|
+
* Date.jisx0301('13.02.03') #=> #<Date: 2001-02-03 ...>
|
4761
|
+
*
|
4758
4762
|
* Raise an ArgumentError when the string length is longer than _limit_.
|
4759
4763
|
* You can stop this check by passing `limit: nil`, but note that
|
4760
4764
|
* it may take a long time to parse.
|
@@ -7190,10 +7194,14 @@ jisx0301_date_format(char *fmt, size_t size, VALUE jd, VALUE y)
|
|
7190
7194
|
c = 'S';
|
7191
7195
|
s = 1925;
|
7192
7196
|
}
|
7193
|
-
else {
|
7197
|
+
else if (d < 2458605) {
|
7194
7198
|
c = 'H';
|
7195
7199
|
s = 1988;
|
7196
7200
|
}
|
7201
|
+
else {
|
7202
|
+
c = 'R';
|
7203
|
+
s = 2018;
|
7204
|
+
}
|
7197
7205
|
snprintf(fmt, size, "%c%02ld" ".%%m.%%d", c, FIX2INT(y) - s);
|
7198
7206
|
return fmt;
|
7199
7207
|
}
|
@@ -8358,6 +8366,11 @@ datetime_s_httpdate(int argc, VALUE *argv, VALUE klass)
|
|
8358
8366
|
* DateTime.jisx0301('H13.02.03T04:05:06+07:00')
|
8359
8367
|
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
8360
8368
|
*
|
8369
|
+
* For no-era year, legacy format, Heisei is assumed.
|
8370
|
+
*
|
8371
|
+
* DateTime.jisx0301('13.02.03T04:05:06+07:00')
|
8372
|
+
* #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
8373
|
+
*
|
8361
8374
|
* Raise an ArgumentError when the string length is longer than _limit_.
|
8362
8375
|
* You can stop this check by passing `limit: nil`, but note that
|
8363
8376
|
* it may take a long time to parse.
|
data/ext/date/date_parse.c
CHANGED
@@ -1212,6 +1212,9 @@ parse_iso2(VALUE str, VALUE hash)
|
|
1212
1212
|
return 1;
|
1213
1213
|
}
|
1214
1214
|
|
1215
|
+
#define JISX0301_ERA_INITIALS "mtshr"
|
1216
|
+
#define JISX0301_DEFAULT_ERA 'H' /* obsolete */
|
1217
|
+
|
1215
1218
|
static int
|
1216
1219
|
gengo(int c)
|
1217
1220
|
{
|
@@ -1222,6 +1225,7 @@ gengo(int c)
|
|
1222
1225
|
case 'T': case 't': e = 1911; break;
|
1223
1226
|
case 'S': case 's': e = 1925; break;
|
1224
1227
|
case 'H': case 'h': e = 1988; break;
|
1228
|
+
case 'R': case 'r': e = 2018; break;
|
1225
1229
|
default: e = 0; break;
|
1226
1230
|
}
|
1227
1231
|
return e;
|
@@ -1252,11 +1256,11 @@ parse_jis(VALUE str, VALUE hash)
|
|
1252
1256
|
{
|
1253
1257
|
static const char pat_source[] =
|
1254
1258
|
#ifndef TIGHT_PARSER
|
1255
|
-
|
1259
|
+
"\\b([" JISX0301_ERA_INITIALS "])(\\d+)\\.(\\d+)\\.(\\d+)"
|
1256
1260
|
#else
|
1257
1261
|
BOS
|
1258
1262
|
FPW_COM FPT_COM
|
1259
|
-
|
1263
|
+
"([" JISX0301_ERA_INITIALS "])(\\d+)\\.(\\d+)\\.(\\d+)"
|
1260
1264
|
TEE_FPT COM_FPW
|
1261
1265
|
EOS
|
1262
1266
|
#endif
|
@@ -2954,7 +2958,7 @@ jisx0301_cb(VALUE m, VALUE hash)
|
|
2954
2958
|
s[i] = rb_reg_nth_match(i, m);
|
2955
2959
|
}
|
2956
2960
|
|
2957
|
-
ep = gengo(NIL_P(s[1]) ?
|
2961
|
+
ep = gengo(NIL_P(s[1]) ? JISX0301_DEFAULT_ERA : *RSTRING_PTR(s[1]));
|
2958
2962
|
set_hash("year", f_add(str2num(s[2]), INT2FIX(ep)));
|
2959
2963
|
set_hash("mon", str2num(s[3]));
|
2960
2964
|
set_hash("mday", str2num(s[4]));
|
@@ -2979,7 +2983,7 @@ static int
|
|
2979
2983
|
jisx0301(VALUE str, VALUE hash)
|
2980
2984
|
{
|
2981
2985
|
static const char pat_source[] =
|
2982
|
-
|
2986
|
+
"\\A\\s*([" JISX0301_ERA_INITIALS "])?(\\d{2})\\.(\\d{2})\\.(\\d{2})"
|
2983
2987
|
"(?:t"
|
2984
2988
|
"(?:(\\d{2}):(\\d{2})(?::(\\d{2})(?:[,.](\\d*))?)?"
|
2985
2989
|
"(z|[-+]\\d{2}(?::?\\d{2})?)?)?)?\\s*\\z";
|
data/lib/date.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: date
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tadayoshi Funaba
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
version: '0'
|
27
27
|
description: A subclass of Object includes Comparable module for handling dates.
|
28
28
|
email:
|
29
|
-
-
|
29
|
+
-
|
30
30
|
executables: []
|
31
31
|
extensions:
|
32
32
|
- ext/date/extconf.rb
|
@@ -46,7 +46,7 @@ homepage: https://github.com/ruby/date
|
|
46
46
|
licenses:
|
47
47
|
- BSD-2-Clause
|
48
48
|
metadata: {}
|
49
|
-
post_install_message:
|
49
|
+
post_install_message:
|
50
50
|
rdoc_options: []
|
51
51
|
require_paths:
|
52
52
|
- lib
|
@@ -61,8 +61,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
63
|
requirements: []
|
64
|
-
rubygems_version: 3.
|
65
|
-
signing_key:
|
64
|
+
rubygems_version: 3.4.0.dev
|
65
|
+
signing_key:
|
66
66
|
specification_version: 4
|
67
67
|
summary: A subclass of Object includes Comparable module for handling dates.
|
68
68
|
test_files: []
|