date 3.0.1 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of date might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/ext/date/date_core.c +62 -44
- data/ext/date/date_parse.c +1 -0
- data/ext/date/date_strptime.c +1 -0
- data/ext/date/prereq.mk +1 -1
- data/ext/date/zonetab.list +7 -7
- data/lib/date.rb +0 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4caa8f18343ab584fcbd5be80672d95d6b72574cc75690e2f591fc671f611aa
|
4
|
+
data.tar.gz: 0d70fbd67392cfdfa0d080d5626808a1c7fc4f834117da812369bf2910c90317
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b36c300a66f6dc671293c647e73014dff9c0460216c177a4cff0977973ca62029b3b9053b87d135a50d3885832edbbc36f0f37280008dca39da711d8070f5c6
|
7
|
+
data.tar.gz: a18e531345a4da23054d03e8480d76afdba97f97a12e56ca840a0dafd6467a1a5d1f9ec9b7e04b0fe6d9e088c1fec078042508aa9cd09e78d4941dc41701662d
|
data/ext/date/date_core.c
CHANGED
@@ -53,6 +53,8 @@ static double positive_inf, negative_inf;
|
|
53
53
|
#define f_add3(x,y,z) f_add(f_add(x, y), z)
|
54
54
|
#define f_sub3(x,y,z) f_sub(f_sub(x, y), z)
|
55
55
|
|
56
|
+
#define f_frozen_ary(...) rb_obj_freeze(rb_ary_new3(__VA_ARGS__))
|
57
|
+
|
56
58
|
static VALUE date_initialize(int argc, VALUE *argv, VALUE self);
|
57
59
|
static VALUE datetime_initialize(int argc, VALUE *argv, VALUE self);
|
58
60
|
|
@@ -2975,7 +2977,7 @@ static const rb_data_type_t d_lite_type = {
|
|
2975
2977
|
"Date",
|
2976
2978
|
{d_lite_gc_mark, RUBY_TYPED_DEFAULT_FREE, d_lite_memsize,},
|
2977
2979
|
0, 0,
|
2978
|
-
RUBY_TYPED_FREE_IMMEDIATELY|RUBY_TYPED_WB_PROTECTED,
|
2980
|
+
RUBY_TYPED_FREE_IMMEDIATELY|RUBY_TYPED_WB_PROTECTED|RUBY_TYPED_FROZEN_SHAREABLE,
|
2979
2981
|
};
|
2980
2982
|
|
2981
2983
|
inline static VALUE
|
@@ -3767,89 +3769,89 @@ rt_complete_frags(VALUE klass, VALUE hash)
|
|
3767
3769
|
VALUE k, a, d;
|
3768
3770
|
|
3769
3771
|
if (NIL_P(tab)) {
|
3770
|
-
tab =
|
3771
|
-
|
3772
|
+
tab = f_frozen_ary(11,
|
3773
|
+
f_frozen_ary(2,
|
3772
3774
|
sym("time"),
|
3773
|
-
|
3775
|
+
f_frozen_ary(3,
|
3774
3776
|
sym("hour"),
|
3775
3777
|
sym("min"),
|
3776
3778
|
sym("sec"))),
|
3777
|
-
|
3779
|
+
f_frozen_ary(2,
|
3778
3780
|
Qnil,
|
3779
|
-
|
3781
|
+
f_frozen_ary(1,
|
3780
3782
|
sym("jd"))),
|
3781
|
-
|
3783
|
+
f_frozen_ary(2,
|
3782
3784
|
sym("ordinal"),
|
3783
|
-
|
3785
|
+
f_frozen_ary(5,
|
3784
3786
|
sym("year"),
|
3785
3787
|
sym("yday"),
|
3786
3788
|
sym("hour"),
|
3787
3789
|
sym("min"),
|
3788
3790
|
sym("sec"))),
|
3789
|
-
|
3791
|
+
f_frozen_ary(2,
|
3790
3792
|
sym("civil"),
|
3791
|
-
|
3793
|
+
f_frozen_ary(6,
|
3792
3794
|
sym("year"),
|
3793
3795
|
sym("mon"),
|
3794
3796
|
sym("mday"),
|
3795
3797
|
sym("hour"),
|
3796
3798
|
sym("min"),
|
3797
3799
|
sym("sec"))),
|
3798
|
-
|
3800
|
+
f_frozen_ary(2,
|
3799
3801
|
sym("commercial"),
|
3800
|
-
|
3802
|
+
f_frozen_ary(6,
|
3801
3803
|
sym("cwyear"),
|
3802
3804
|
sym("cweek"),
|
3803
3805
|
sym("cwday"),
|
3804
3806
|
sym("hour"),
|
3805
3807
|
sym("min"),
|
3806
3808
|
sym("sec"))),
|
3807
|
-
|
3809
|
+
f_frozen_ary(2,
|
3808
3810
|
sym("wday"),
|
3809
|
-
|
3811
|
+
f_frozen_ary(4,
|
3810
3812
|
sym("wday"),
|
3811
3813
|
sym("hour"),
|
3812
3814
|
sym("min"),
|
3813
3815
|
sym("sec"))),
|
3814
|
-
|
3816
|
+
f_frozen_ary(2,
|
3815
3817
|
sym("wnum0"),
|
3816
|
-
|
3818
|
+
f_frozen_ary(6,
|
3817
3819
|
sym("year"),
|
3818
3820
|
sym("wnum0"),
|
3819
3821
|
sym("wday"),
|
3820
3822
|
sym("hour"),
|
3821
3823
|
sym("min"),
|
3822
3824
|
sym("sec"))),
|
3823
|
-
|
3825
|
+
f_frozen_ary(2,
|
3824
3826
|
sym("wnum1"),
|
3825
|
-
|
3827
|
+
f_frozen_ary(6,
|
3826
3828
|
sym("year"),
|
3827
3829
|
sym("wnum1"),
|
3828
3830
|
sym("wday"),
|
3829
3831
|
sym("hour"),
|
3830
3832
|
sym("min"),
|
3831
3833
|
sym("sec"))),
|
3832
|
-
|
3834
|
+
f_frozen_ary(2,
|
3833
3835
|
Qnil,
|
3834
|
-
|
3836
|
+
f_frozen_ary(6,
|
3835
3837
|
sym("cwyear"),
|
3836
3838
|
sym("cweek"),
|
3837
3839
|
sym("wday"),
|
3838
3840
|
sym("hour"),
|
3839
3841
|
sym("min"),
|
3840
3842
|
sym("sec"))),
|
3841
|
-
|
3843
|
+
f_frozen_ary(2,
|
3842
3844
|
Qnil,
|
3843
|
-
|
3845
|
+
f_frozen_ary(6,
|
3844
3846
|
sym("year"),
|
3845
3847
|
sym("wnum0"),
|
3846
3848
|
sym("cwday"),
|
3847
3849
|
sym("hour"),
|
3848
3850
|
sym("min"),
|
3849
3851
|
sym("sec"))),
|
3850
|
-
|
3852
|
+
f_frozen_ary(2,
|
3851
3853
|
Qnil,
|
3852
|
-
|
3854
|
+
f_frozen_ary(6,
|
3853
3855
|
sym("year"),
|
3854
3856
|
sym("wnum1"),
|
3855
3857
|
sym("cwday"),
|
@@ -4345,8 +4347,12 @@ date_s__parse_internal(int argc, VALUE *argv, VALUE klass)
|
|
4345
4347
|
* Date._parse(string[, comp=true]) -> hash
|
4346
4348
|
*
|
4347
4349
|
* Parses the given representation of date and time, and returns a
|
4348
|
-
* hash of parsed elements.
|
4349
|
-
*
|
4350
|
+
* hash of parsed elements.
|
4351
|
+
*
|
4352
|
+
* This method **does not** function as a validator. If the input
|
4353
|
+
* string does not match valid formats strictly, you may get a cryptic
|
4354
|
+
* result. Should consider to use `Date._strptime` or
|
4355
|
+
* `DateTime._strptime` instead of this method as possible.
|
4350
4356
|
*
|
4351
4357
|
* If the optional second argument is true and the detected year is in
|
4352
4358
|
* the range "00" to "99", considers the year a 2-digit form and makes
|
@@ -4365,7 +4371,12 @@ date_s__parse(int argc, VALUE *argv, VALUE klass)
|
|
4365
4371
|
* Date.parse(string='-4712-01-01'[, comp=true[, start=Date::ITALY]]) -> date
|
4366
4372
|
*
|
4367
4373
|
* Parses the given representation of date and time, and creates a
|
4368
|
-
* date object.
|
4374
|
+
* date object.
|
4375
|
+
*
|
4376
|
+
* This method **does not** function as a validator. If the input
|
4377
|
+
* string does not match valid formats strictly, you may get a cryptic
|
4378
|
+
* result. Should consider to use `Date.strptime` instead of this
|
4379
|
+
* method as possible.
|
4369
4380
|
*
|
4370
4381
|
* If the optional second argument is true and the detected year is in
|
4371
4382
|
* the range "00" to "99", considers the year a 2-digit form and makes
|
@@ -8001,7 +8012,12 @@ datetime_s_strptime(int argc, VALUE *argv, VALUE klass)
|
|
8001
8012
|
* DateTime.parse(string='-4712-01-01T00:00:00+00:00'[, comp=true[, start=Date::ITALY]]) -> datetime
|
8002
8013
|
*
|
8003
8014
|
* Parses the given representation of date and time, and creates a
|
8004
|
-
* DateTime object.
|
8015
|
+
* DateTime object.
|
8016
|
+
*
|
8017
|
+
* This method **does not** function as a validator. If the input
|
8018
|
+
* string does not match valid formats strictly, you may get a cryptic
|
8019
|
+
* result. Should consider to use `DateTime.strptime` instead of this
|
8020
|
+
* method as possible.
|
8005
8021
|
*
|
8006
8022
|
* If the optional second argument is true and the detected year is in
|
8007
8023
|
* the range "00" to "99", makes it full.
|
@@ -9102,13 +9118,13 @@ d_lite_zero(VALUE x)
|
|
9102
9118
|
void
|
9103
9119
|
Init_date_core(void)
|
9104
9120
|
{
|
9105
|
-
#
|
9106
|
-
|
9107
|
-
|
9108
|
-
id_cmp =
|
9109
|
-
id_le_p =
|
9110
|
-
id_ge_p =
|
9111
|
-
id_eqeq_p =
|
9121
|
+
#ifdef HAVE_RB_EXT_RACTOR_SAFE
|
9122
|
+
RB_EXT_RACTOR_SAFE(true);
|
9123
|
+
#endif
|
9124
|
+
id_cmp = rb_intern_const("<=>");
|
9125
|
+
id_le_p = rb_intern_const("<=");
|
9126
|
+
id_ge_p = rb_intern_const(">=");
|
9127
|
+
id_eqeq_p = rb_intern_const("==");
|
9112
9128
|
|
9113
9129
|
half_days_in_day = rb_rational_new2(INT2FIX(1), INT2FIX(2));
|
9114
9130
|
|
@@ -9515,6 +9531,8 @@ Init_date_core(void)
|
|
9515
9531
|
* A subclass of Date that easily handles date, hour, minute, second,
|
9516
9532
|
* and offset.
|
9517
9533
|
*
|
9534
|
+
* DateTime class is considered deprecated. Use Time class.
|
9535
|
+
*
|
9518
9536
|
* DateTime does not consider any leap seconds, does not track
|
9519
9537
|
* any summer time rules.
|
9520
9538
|
*
|
@@ -9575,18 +9593,18 @@ Init_date_core(void)
|
|
9575
9593
|
* === When should you use DateTime and when should you use Time?
|
9576
9594
|
*
|
9577
9595
|
* It's a common misconception that
|
9578
|
-
* {William Shakespeare}[
|
9596
|
+
* {William Shakespeare}[https://en.wikipedia.org/wiki/William_Shakespeare]
|
9579
9597
|
* and
|
9580
|
-
* {Miguel de Cervantes}[
|
9598
|
+
* {Miguel de Cervantes}[https://en.wikipedia.org/wiki/Miguel_de_Cervantes]
|
9581
9599
|
* died on the same day in history -
|
9582
9600
|
* so much so that UNESCO named April 23 as
|
9583
|
-
* {World Book Day because of this fact}[
|
9601
|
+
* {World Book Day because of this fact}[https://en.wikipedia.org/wiki/World_Book_Day].
|
9584
9602
|
* However, because England hadn't yet adopted the
|
9585
|
-
* {Gregorian Calendar Reform}[
|
9586
|
-
* (and wouldn't until {1752}[
|
9603
|
+
* {Gregorian Calendar Reform}[https://en.wikipedia.org/wiki/Gregorian_calendar#Gregorian_reform]
|
9604
|
+
* (and wouldn't until {1752}[https://en.wikipedia.org/wiki/Calendar_(New_Style)_Act_1750])
|
9587
9605
|
* their deaths are actually 10 days apart.
|
9588
9606
|
* Since Ruby's Time class implements a
|
9589
|
-
* {proleptic Gregorian calendar}[
|
9607
|
+
* {proleptic Gregorian calendar}[https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar]
|
9590
9608
|
* and has no concept of calendar reform there's no way
|
9591
9609
|
* to express this with Time objects. This is where DateTime steps in:
|
9592
9610
|
*
|
@@ -9630,7 +9648,7 @@ Init_date_core(void)
|
|
9630
9648
|
* #=> Fri, 04 May 1753 00:00:00 +0000
|
9631
9649
|
*
|
9632
9650
|
* As you can see, if we're accurately tracking the number of
|
9633
|
-
* {solar years}[
|
9651
|
+
* {solar years}[https://en.wikipedia.org/wiki/Tropical_year]
|
9634
9652
|
* since Shakespeare's birthday then the correct anniversary date
|
9635
9653
|
* would be the 4th May and not the 23rd April.
|
9636
9654
|
*
|
@@ -9642,10 +9660,10 @@ Init_date_core(void)
|
|
9642
9660
|
* making the same mistakes as UNESCO. If you also have to deal
|
9643
9661
|
* with timezones then best of luck - just bear in mind that
|
9644
9662
|
* you'll probably be dealing with
|
9645
|
-
* {local solar times}[
|
9663
|
+
* {local solar times}[https://en.wikipedia.org/wiki/Solar_time],
|
9646
9664
|
* since it wasn't until the 19th century that the introduction
|
9647
9665
|
* of the railways necessitated the need for
|
9648
|
-
* {Standard Time}[
|
9666
|
+
* {Standard Time}[https://en.wikipedia.org/wiki/Standard_time#Great_Britain]
|
9649
9667
|
* and eventually timezones.
|
9650
9668
|
*/
|
9651
9669
|
|
data/ext/date/date_parse.c
CHANGED
data/ext/date/date_strptime.c
CHANGED
data/ext/date/prereq.mk
CHANGED
data/ext/date/zonetab.list
CHANGED
@@ -47,12 +47,12 @@ utc, 0*3600
|
|
47
47
|
wet, 0*3600
|
48
48
|
at, -2*3600
|
49
49
|
brst,-2*3600
|
50
|
-
ndt, -(
|
50
|
+
ndt, -(1*3600+1800)
|
51
51
|
art, -3*3600
|
52
52
|
adt, -3*3600
|
53
53
|
brt, -3*3600
|
54
54
|
clst,-3*3600
|
55
|
-
nst, -(
|
55
|
+
nst, -(2*3600+1800)
|
56
56
|
ast, -4*3600
|
57
57
|
clt, -4*3600
|
58
58
|
akdt,-8*3600
|
@@ -62,7 +62,7 @@ hadt,-9*3600
|
|
62
62
|
hdt, -9*3600
|
63
63
|
yst, -9*3600
|
64
64
|
ahst,-10*3600
|
65
|
-
cat
|
65
|
+
cat,2*3600
|
66
66
|
hast,-10*3600
|
67
67
|
hst,-10*3600
|
68
68
|
nt, -11*3600
|
@@ -82,7 +82,7 @@ fst, 2*3600
|
|
82
82
|
mest, 2*3600
|
83
83
|
mesz, 2*3600
|
84
84
|
sast, 2*3600
|
85
|
-
sst,
|
85
|
+
sst, -11*3600
|
86
86
|
bt, 3*3600
|
87
87
|
eat, 3*3600
|
88
88
|
eest, 3*3600
|
@@ -92,13 +92,13 @@ zp4, 4*3600
|
|
92
92
|
zp5, 5*3600
|
93
93
|
ist, (5*3600+1800)
|
94
94
|
zp6, 6*3600
|
95
|
-
wast,
|
96
|
-
cct,
|
95
|
+
wast, 2*3600
|
96
|
+
cct, (6*3600+1800)
|
97
97
|
sgt, 8*3600
|
98
98
|
wadt, 8*3600
|
99
99
|
jst, 9*3600
|
100
100
|
kst, 9*3600
|
101
|
-
east
|
101
|
+
east,-6*3600
|
102
102
|
gst, 10*3600
|
103
103
|
eadt,11*3600
|
104
104
|
idle,12*3600
|
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: 3.0
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tadayoshi Funaba
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A subclass of Object includes Comparable module for handling dates.
|
14
14
|
email:
|
@@ -30,6 +30,7 @@ files:
|
|
30
30
|
- lib/date.rb
|
31
31
|
homepage: https://github.com/ruby/date
|
32
32
|
licenses:
|
33
|
+
- Ruby
|
33
34
|
- BSD-2-Clause
|
34
35
|
metadata: {}
|
35
36
|
post_install_message:
|
@@ -47,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
47
48
|
- !ruby/object:Gem::Version
|
48
49
|
version: '0'
|
49
50
|
requirements: []
|
50
|
-
rubygems_version: 3.2.
|
51
|
+
rubygems_version: 3.2.2
|
51
52
|
signing_key:
|
52
53
|
specification_version: 4
|
53
54
|
summary: A subclass of Object includes Comparable module for handling dates.
|