date 3.4.1 → 3.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b82de0c3b7d4685d8aa478af5ce4d919808d79d83b71012b0f61052c37a1506
4
- data.tar.gz: 6a1adeb0b3d43f3afdc9edb06c1b2bfd081f726e3b91dff9d5d482e77cf87d11
3
+ metadata.gz: a4bfc8d13122968d3e8be9e00abdcac1308a4b86f699d5747e492ee80d97ed13
4
+ data.tar.gz: 579ae53dacefba07eabb2e2a6b9cada3c377efd0348d3290e4a6b392059f9883
5
5
  SHA512:
6
- metadata.gz: 69bc90e06d9f020e5c391732c6b95c8fabe8abe705be5760b5f303980b90ffda96ae55c0ad837a23c8c6701b63783a0a7c16bd2e13f82f7903c1c47089312645
7
- data.tar.gz: 7c0aff9c2c9a43f3ac6b1f53a9530805792c7941c45074f5bb58cb90b24890efc641b374cbee7fd36ac8124426a748da92a67d148bb07329b62a90f14bfb9194
6
+ metadata.gz: f75049bebd6c5c9acd3ed8290be91514f20cd275348e4c6d1887175ccac2c88890f0b07e8236d24bb37cab3223d7d1038e02726f880ec7c186a1ce300c196fe5
7
+ data.tar.gz: c1d74e9cb222d4eb2f3b5715d6aa68a411b6b92ca05cc47babcee05343e455ba218a15b9c12f25d925887ea7a7dac0a203011a2e5e783269a2f16de921143fba
data/BSDL ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (C) 1993-2013 Yukihiro Matsumoto. All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions
5
+ are met:
6
+ 1. Redistributions of source code must retain the above copyright
7
+ notice, this list of conditions and the following disclaimer.
8
+ 2. Redistributions in binary form must reproduce the above copyright
9
+ notice, this list of conditions and the following disclaimer in the
10
+ documentation and/or other materials provided with the distribution.
11
+
12
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
13
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
16
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
18
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22
+ SUCH DAMAGE.
data/COPYING ADDED
@@ -0,0 +1,56 @@
1
+ Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
2
+ You can redistribute it and/or modify it under either the terms of the
3
+ 2-clause BSDL (see the file BSDL), or the conditions below:
4
+
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a. place your modifications in the Public Domain or otherwise
13
+ make them Freely Available, such as by posting said
14
+ modifications to Usenet or an equivalent medium, or by allowing
15
+ the author to include your modifications in the software.
16
+
17
+ b. use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c. give non-standard binaries non-standard names, with
21
+ instructions on where to get the original software distribution.
22
+
23
+ d. make other distribution arrangements with the author.
24
+
25
+ 3. You may distribute the software in object code or binary form,
26
+ provided that you do at least ONE of the following:
27
+
28
+ a. distribute the binaries and library files of the software,
29
+ together with instructions (in the manual page or equivalent)
30
+ on where to get the original distribution.
31
+
32
+ b. accompany the distribution with the machine-readable source of
33
+ the software.
34
+
35
+ c. give non-standard binaries non-standard names, with
36
+ instructions on where to get the original software distribution.
37
+
38
+ d. make other distribution arrangements with the author.
39
+
40
+ 4. You may modify and include the part of the software into any other
41
+ software (possibly commercial). But some files in the distribution
42
+ are not written by the author, so that they are not under these terms.
43
+
44
+ For the list of those files and their copying conditions, see the
45
+ file LEGAL.
46
+
47
+ 5. The scripts and library files supplied as input to or produced as
48
+ output from the software do not automatically fall under the
49
+ copyright of the software, but belong to whomever generated them,
50
+ and may be sold commercially, and may be aggregated with this
51
+ software.
52
+
53
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
+ PURPOSE.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # `Date`
2
2
 
3
- A subclass of `Object` that includes the `Comparable` module and easily handles date.
3
+ The official date library for Ruby.
4
4
 
5
5
  ## Installation
6
6
 
data/ext/date/date_core.c CHANGED
@@ -1599,7 +1599,7 @@ m_ajd(union DateData *x)
1599
1599
 
1600
1600
  if (simple_dat_p(x)) {
1601
1601
  r = m_real_jd(x);
1602
- if (FIXNUM_P(r) && FIX2LONG(r) <= (FIXNUM_MAX / 2)) {
1602
+ if (FIXNUM_P(r) && FIX2LONG(r) <= (FIXNUM_MAX / 2) && FIX2LONG(r) >= (FIXNUM_MIN + 1) / 2) {
1603
1603
  long ir = FIX2LONG(r);
1604
1604
  ir = ir * 2 - 1;
1605
1605
  return rb_rational_new2(LONG2FIX(ir), INT2FIX(2));
@@ -2498,7 +2498,7 @@ date_s__valid_jd_p(int argc, VALUE *argv, VALUE klass)
2498
2498
  *
2499
2499
  * Date.valid_jd?(2451944) # => true
2500
2500
  *
2501
- * See argument {start}[rdoc-ref:calendars.rdoc@Argument+start].
2501
+ * See argument {start}[rdoc-ref:date/calendars.rdoc@Argument+start].
2502
2502
  *
2503
2503
  * Related: Date.jd.
2504
2504
  */
@@ -2592,7 +2592,7 @@ date_s__valid_civil_p(int argc, VALUE *argv, VALUE klass)
2592
2592
  * Date.valid_date?(2001, 2, 29) # => false
2593
2593
  * Date.valid_date?(2001, 2, -1) # => true
2594
2594
  *
2595
- * See argument {start}[rdoc-ref:calendars.rdoc@Argument+start].
2595
+ * See argument {start}[rdoc-ref:date/calendars.rdoc@Argument+start].
2596
2596
  *
2597
2597
  * Related: Date.jd, Date.new.
2598
2598
  */
@@ -2680,7 +2680,7 @@ date_s__valid_ordinal_p(int argc, VALUE *argv, VALUE klass)
2680
2680
  * Date.valid_ordinal?(2001, 34) # => true
2681
2681
  * Date.valid_ordinal?(2001, 366) # => false
2682
2682
  *
2683
- * See argument {start}[rdoc-ref:calendars.rdoc@Argument+start].
2683
+ * See argument {start}[rdoc-ref:date/calendars.rdoc@Argument+start].
2684
2684
  *
2685
2685
  * Related: Date.jd, Date.ordinal.
2686
2686
  */
@@ -2770,7 +2770,7 @@ date_s__valid_commercial_p(int argc, VALUE *argv, VALUE klass)
2770
2770
  *
2771
2771
  * See Date.commercial.
2772
2772
  *
2773
- * See argument {start}[rdoc-ref:calendars.rdoc@Argument+start].
2773
+ * See argument {start}[rdoc-ref:date/calendars.rdoc@Argument+start].
2774
2774
  *
2775
2775
  * Related: Date.jd, Date.commercial.
2776
2776
  */
@@ -3350,7 +3350,7 @@ static VALUE d_lite_plus(VALUE, VALUE);
3350
3350
  *
3351
3351
  * Date.jd(Date::ITALY - 1).julian? # => true
3352
3352
  *
3353
- * See argument {start}[rdoc-ref:calendars.rdoc@Argument+start].
3353
+ * See argument {start}[rdoc-ref:date/calendars.rdoc@Argument+start].
3354
3354
  *
3355
3355
  * Related: Date.new.
3356
3356
  */
@@ -3415,7 +3415,7 @@ date_s_jd(int argc, VALUE *argv, VALUE klass)
3415
3415
  *
3416
3416
  * Raises an exception if +yday+ is zero or out of range.
3417
3417
  *
3418
- * See argument {start}[rdoc-ref:calendars.rdoc@Argument+start].
3418
+ * See argument {start}[rdoc-ref:date/calendars.rdoc@Argument+start].
3419
3419
  *
3420
3420
  * Related: Date.jd, Date.new.
3421
3421
  */
@@ -3492,7 +3492,7 @@ date_s_civil(int argc, VALUE *argv, VALUE klass)
3492
3492
  * where +n+ is the number of days in the month;
3493
3493
  * when the argument is negative, counts backward from the end of the month.
3494
3494
  *
3495
- * See argument {start}[rdoc-ref:calendars.rdoc@Argument+start].
3495
+ * See argument {start}[rdoc-ref:date/calendars.rdoc@Argument+start].
3496
3496
  *
3497
3497
  * Related: Date.jd.
3498
3498
  */
@@ -3598,7 +3598,7 @@ date_initialize(int argc, VALUE *argv, VALUE self)
3598
3598
  * Date.commercial(2020, 1, 1).to_s # => "2019-12-30"
3599
3599
  Date.commercial(2020, 1, 7).to_s # => "2020-01-05"
3600
3600
  *
3601
- * See argument {start}[rdoc-ref:calendars.rdoc@Argument+start].
3601
+ * See argument {start}[rdoc-ref:date/calendars.rdoc@Argument+start].
3602
3602
  *
3603
3603
  * Related: Date.jd, Date.new, Date.ordinal.
3604
3604
  */
@@ -3783,7 +3783,7 @@ static void set_sg(union DateData *, double);
3783
3783
  *
3784
3784
  * Date.today.to_s # => "2022-07-06"
3785
3785
  *
3786
- * See argument {start}[rdoc-ref:calendars.rdoc@Argument+start].
3786
+ * See argument {start}[rdoc-ref:date/calendars.rdoc@Argument+start].
3787
3787
  *
3788
3788
  */
3789
3789
  static VALUE
@@ -3878,7 +3878,6 @@ static VALUE
3878
3878
  rt_complete_frags(VALUE klass, VALUE hash)
3879
3879
  {
3880
3880
  static VALUE tab = Qnil;
3881
- int g;
3882
3881
  long e;
3883
3882
  VALUE k, a, d;
3884
3883
 
@@ -3975,9 +3974,13 @@ rt_complete_frags(VALUE klass, VALUE hash)
3975
3974
  rb_gc_register_mark_object(tab);
3976
3975
  }
3977
3976
 
3977
+ k = a = Qnil;
3978
+
3978
3979
  {
3979
- long i, eno = 0, idx = 0;
3980
+ long i, eno = 0;
3981
+ VALUE t = Qnil;
3980
3982
 
3983
+ e = 0;
3981
3984
  for (i = 0; i < RARRAY_LEN(tab); i++) {
3982
3985
  VALUE x, a;
3983
3986
 
@@ -3992,23 +3995,20 @@ rt_complete_frags(VALUE klass, VALUE hash)
3992
3995
  n++;
3993
3996
  if (n > eno) {
3994
3997
  eno = n;
3995
- idx = i;
3998
+ t = x;
3996
3999
  }
3997
4000
  }
3998
4001
  }
3999
- if (eno == 0)
4000
- g = 0;
4001
- else {
4002
- g = 1;
4003
- k = RARRAY_AREF(RARRAY_AREF(tab, idx), 0);
4004
- a = RARRAY_AREF(RARRAY_AREF(tab, idx), 1);
4005
- e = eno;
4002
+ if (eno > 0) {
4003
+ k = RARRAY_AREF(t, 0);
4004
+ a = RARRAY_AREF(t, 1);
4006
4005
  }
4006
+ e = eno;
4007
4007
  }
4008
4008
 
4009
4009
  d = Qnil;
4010
4010
 
4011
- if (g && !NIL_P(k) && (RARRAY_LEN(a) - e)) {
4011
+ if (!NIL_P(k) && (RARRAY_LEN(a) > e)) {
4012
4012
  if (k == sym("ordinal")) {
4013
4013
  if (NIL_P(ref_hash("year"))) {
4014
4014
  if (NIL_P(d))
@@ -4095,7 +4095,7 @@ rt_complete_frags(VALUE klass, VALUE hash)
4095
4095
  }
4096
4096
  }
4097
4097
 
4098
- if (g && k == sym("time")) {
4098
+ if (k == sym("time")) {
4099
4099
  if (f_le_p(klass, cDateTime)) {
4100
4100
  if (NIL_P(d))
4101
4101
  d = date_s_today(0, (VALUE *)0, cDate);
@@ -4415,7 +4415,7 @@ date_s__strptime(int argc, VALUE *argv, VALUE klass)
4415
4415
  * {Formats for Dates and Times}[https://docs.ruby-lang.org/en/master/strftime_formatting_rdoc.html].
4416
4416
  * (Unlike Date.strftime, does not support flags and width.)
4417
4417
  *
4418
- * See argument {start}[rdoc-ref:calendars.rdoc@Argument+start].
4418
+ * See argument {start}[rdoc-ref:date/calendars.rdoc@Argument+start].
4419
4419
  *
4420
4420
  * See also {strptime(3)}[https://man7.org/linux/man-pages/man3/strptime.3.html].
4421
4421
  *
@@ -4464,11 +4464,10 @@ get_limit(VALUE opt)
4464
4464
  #define rb_category_warn(category, fmt) rb_warn(fmt)
4465
4465
  #endif
4466
4466
 
4467
- static void
4467
+ static VALUE
4468
4468
  check_limit(VALUE str, VALUE opt)
4469
4469
  {
4470
4470
  size_t slen, limit;
4471
- if (NIL_P(str)) return;
4472
4471
  StringValue(str);
4473
4472
  slen = RSTRING_LEN(str);
4474
4473
  limit = get_limit(opt);
@@ -4476,6 +4475,7 @@ check_limit(VALUE str, VALUE opt)
4476
4475
  rb_raise(rb_eArgError,
4477
4476
  "string length (%"PRI_SIZE_PREFIX"u) exceeds the limit %"PRI_SIZE_PREFIX"u", slen, limit);
4478
4477
  }
4478
+ return str;
4479
4479
  }
4480
4480
 
4481
4481
  static VALUE
@@ -4484,8 +4484,7 @@ date_s__parse_internal(int argc, VALUE *argv, VALUE klass)
4484
4484
  VALUE vstr, vcomp, hash, opt;
4485
4485
 
4486
4486
  argc = rb_scan_args(argc, argv, "11:", &vstr, &vcomp, &opt);
4487
- check_limit(vstr, opt);
4488
- StringValue(vstr);
4487
+ vstr = check_limit(vstr, opt);
4489
4488
  if (!rb_enc_str_asciicompat_p(vstr))
4490
4489
  rb_raise(rb_eArgError,
4491
4490
  "string should have ASCII compatible encoding");
@@ -4560,7 +4559,7 @@ date_s__parse(int argc, VALUE *argv, VALUE klass)
4560
4559
  *
4561
4560
  * See:
4562
4561
  *
4563
- * - Argument {start}[rdoc-ref:calendars.rdoc@Argument+start].
4562
+ * - Argument {start}[rdoc-ref:date/calendars.rdoc@Argument+start].
4564
4563
  * - Argument {limit}[rdoc-ref:Date@Argument+limit].
4565
4564
  *
4566
4565
  * Related: Date._parse (returns a hash).
@@ -4620,7 +4619,7 @@ date_s__iso8601(int argc, VALUE *argv, VALUE klass)
4620
4619
  VALUE str, opt;
4621
4620
 
4622
4621
  rb_scan_args(argc, argv, "1:", &str, &opt);
4623
- check_limit(str, opt);
4622
+ if (!NIL_P(str)) str = check_limit(str, opt);
4624
4623
 
4625
4624
  return date__iso8601(str);
4626
4625
  }
@@ -4639,7 +4638,7 @@ date_s__iso8601(int argc, VALUE *argv, VALUE klass)
4639
4638
  *
4640
4639
  * See:
4641
4640
  *
4642
- * - Argument {start}[rdoc-ref:calendars.rdoc@Argument+start].
4641
+ * - Argument {start}[rdoc-ref:date/calendars.rdoc@Argument+start].
4643
4642
  * - Argument {limit}[rdoc-ref:Date@Argument+limit].
4644
4643
  *
4645
4644
  * Related: Date._iso8601 (returns a hash).
@@ -4690,7 +4689,7 @@ date_s__rfc3339(int argc, VALUE *argv, VALUE klass)
4690
4689
  VALUE str, opt;
4691
4690
 
4692
4691
  rb_scan_args(argc, argv, "1:", &str, &opt);
4693
- check_limit(str, opt);
4692
+ if (!NIL_P(str)) str = check_limit(str, opt);
4694
4693
 
4695
4694
  return date__rfc3339(str);
4696
4695
  }
@@ -4709,7 +4708,7 @@ date_s__rfc3339(int argc, VALUE *argv, VALUE klass)
4709
4708
  *
4710
4709
  * See:
4711
4710
  *
4712
- * - Argument {start}[rdoc-ref:calendars.rdoc@Argument+start].
4711
+ * - Argument {start}[rdoc-ref:date/calendars.rdoc@Argument+start].
4713
4712
  * - Argument {limit}[rdoc-ref:Date@Argument+limit].
4714
4713
  *
4715
4714
  * Related: Date._rfc3339 (returns a hash).
@@ -4759,7 +4758,7 @@ date_s__xmlschema(int argc, VALUE *argv, VALUE klass)
4759
4758
  VALUE str, opt;
4760
4759
 
4761
4760
  rb_scan_args(argc, argv, "1:", &str, &opt);
4762
- check_limit(str, opt);
4761
+ if (!NIL_P(str)) str = check_limit(str, opt);
4763
4762
 
4764
4763
  return date__xmlschema(str);
4765
4764
  }
@@ -4777,7 +4776,7 @@ date_s__xmlschema(int argc, VALUE *argv, VALUE klass)
4777
4776
  *
4778
4777
  * See:
4779
4778
  *
4780
- * - Argument {start}[rdoc-ref:calendars.rdoc@Argument+start].
4779
+ * - Argument {start}[rdoc-ref:date/calendars.rdoc@Argument+start].
4781
4780
  * - Argument {limit}[rdoc-ref:Date@Argument+limit].
4782
4781
  *
4783
4782
  * Related: Date._xmlschema (returns a hash).
@@ -4828,7 +4827,7 @@ date_s__rfc2822(int argc, VALUE *argv, VALUE klass)
4828
4827
  VALUE str, opt;
4829
4828
 
4830
4829
  rb_scan_args(argc, argv, "1:", &str, &opt);
4831
- check_limit(str, opt);
4830
+ if (!NIL_P(str)) str = check_limit(str, opt);
4832
4831
 
4833
4832
  return date__rfc2822(str);
4834
4833
  }
@@ -4847,7 +4846,7 @@ date_s__rfc2822(int argc, VALUE *argv, VALUE klass)
4847
4846
  *
4848
4847
  * See:
4849
4848
  *
4850
- * - Argument {start}[rdoc-ref:calendars.rdoc@Argument+start].
4849
+ * - Argument {start}[rdoc-ref:date/calendars.rdoc@Argument+start].
4851
4850
  * - Argument {limit}[rdoc-ref:Date@Argument+limit].
4852
4851
  *
4853
4852
  * Related: Date._rfc2822 (returns a hash).
@@ -4896,7 +4895,7 @@ date_s__httpdate(int argc, VALUE *argv, VALUE klass)
4896
4895
  VALUE str, opt;
4897
4896
 
4898
4897
  rb_scan_args(argc, argv, "1:", &str, &opt);
4899
- check_limit(str, opt);
4898
+ if (!NIL_P(str)) str = check_limit(str, opt);
4900
4899
 
4901
4900
  return date__httpdate(str);
4902
4901
  }
@@ -4915,7 +4914,7 @@ date_s__httpdate(int argc, VALUE *argv, VALUE klass)
4915
4914
  *
4916
4915
  * See:
4917
4916
  *
4918
- * - Argument {start}[rdoc-ref:calendars.rdoc@Argument+start].
4917
+ * - Argument {start}[rdoc-ref:date/calendars.rdoc@Argument+start].
4919
4918
  * - Argument {limit}[rdoc-ref:Date@Argument+limit].
4920
4919
  *
4921
4920
  * Related: Date._httpdate (returns a hash).
@@ -4965,7 +4964,7 @@ date_s__jisx0301(int argc, VALUE *argv, VALUE klass)
4965
4964
  VALUE str, opt;
4966
4965
 
4967
4966
  rb_scan_args(argc, argv, "1:", &str, &opt);
4968
- check_limit(str, opt);
4967
+ if (!NIL_P(str)) str = check_limit(str, opt);
4969
4968
 
4970
4969
  return date__jisx0301(str);
4971
4970
  }
@@ -4987,7 +4986,7 @@ date_s__jisx0301(int argc, VALUE *argv, VALUE klass)
4987
4986
  *
4988
4987
  * See:
4989
4988
  *
4990
- * - Argument {start}[rdoc-ref:calendars.rdoc@Argument+start].
4989
+ * - Argument {start}[rdoc-ref:date/calendars.rdoc@Argument+start].
4991
4990
  * - Argument {limit}[rdoc-ref:Date@Argument+limit].
4992
4991
  *
4993
4992
  * Related: Date._jisx0301 (returns a hash).
@@ -5745,7 +5744,7 @@ d_lite_leap_p(VALUE self)
5745
5744
  * Date.new(2001, 2, 3, Date::GREGORIAN).start # => -Infinity
5746
5745
  * Date.new(2001, 2, 3, Date::JULIAN).start # => Infinity
5747
5746
  *
5748
- * See argument {start}[rdoc-ref:calendars.rdoc@Argument+start].
5747
+ * See argument {start}[rdoc-ref:date/calendars.rdoc@Argument+start].
5749
5748
  *
5750
5749
  */
5751
5750
  static VALUE
@@ -5820,7 +5819,7 @@ dup_obj_with_new_start(VALUE obj, double sg)
5820
5819
  * d1 = d0.new_start(Date::JULIAN)
5821
5820
  * d1.julian? # => true
5822
5821
  *
5823
- * See argument {start}[rdoc-ref:calendars.rdoc@Argument+start].
5822
+ * See argument {start}[rdoc-ref:date/calendars.rdoc@Argument+start].
5824
5823
  *
5825
5824
  */
5826
5825
  static VALUE
@@ -6936,13 +6935,24 @@ d_lite_eql_p(VALUE self, VALUE other)
6936
6935
  static VALUE
6937
6936
  d_lite_hash(VALUE self)
6938
6937
  {
6939
- st_index_t v, h[4];
6938
+ st_index_t v, h[5];
6939
+ VALUE nth;
6940
6940
 
6941
6941
  get_d1(self);
6942
- h[0] = m_nth(dat);
6943
- h[1] = m_jd(dat);
6944
- h[2] = m_df(dat);
6945
- h[3] = m_sf(dat);
6942
+ nth = m_nth(dat);
6943
+
6944
+ if (FIXNUM_P(nth)) {
6945
+ h[0] = 0;
6946
+ h[1] = (st_index_t)nth;
6947
+ } else {
6948
+ h[0] = 1;
6949
+ h[1] = (st_index_t)FIX2LONG(rb_hash(nth));
6950
+ }
6951
+
6952
+ h[2] = m_jd(dat);
6953
+ h[3] = m_df(dat);
6954
+ h[4] = m_sf(dat);
6955
+
6946
6956
  v = rb_memhash(h, sizeof(h));
6947
6957
  return ST2FIX(v);
6948
6958
  }
@@ -7517,10 +7527,7 @@ d_lite_marshal_dump_old(VALUE self)
7517
7527
  m_of_in_day(dat),
7518
7528
  DBL2NUM(m_sg(dat)));
7519
7529
 
7520
- if (FL_TEST(self, FL_EXIVAR)) {
7521
- rb_copy_generic_ivar(a, self);
7522
- FL_SET(a, FL_EXIVAR);
7523
- }
7530
+ rb_copy_generic_ivar(a, self);
7524
7531
 
7525
7532
  return a;
7526
7533
  }
@@ -7542,10 +7549,8 @@ d_lite_marshal_dump(VALUE self)
7542
7549
  INT2FIX(m_of(dat)),
7543
7550
  DBL2NUM(m_sg(dat)));
7544
7551
 
7545
- if (FL_TEST(self, FL_EXIVAR)) {
7546
- rb_copy_generic_ivar(a, self);
7547
- FL_SET(a, FL_EXIVAR);
7548
- }
7552
+
7553
+ rb_copy_generic_ivar(a, self);
7549
7554
 
7550
7555
  return a;
7551
7556
  }
@@ -7618,10 +7623,7 @@ d_lite_marshal_load(VALUE self, VALUE a)
7618
7623
  HAVE_JD | HAVE_DF);
7619
7624
  }
7620
7625
 
7621
- if (FL_TEST(a, FL_EXIVAR)) {
7622
- rb_copy_generic_ivar(self, a);
7623
- FL_SET(self, FL_EXIVAR);
7624
- }
7626
+ rb_copy_generic_ivar(self, a);
7625
7627
 
7626
7628
  return self;
7627
7629
  }
@@ -9522,7 +9524,7 @@ Init_date_core(void)
9522
9524
  *
9523
9525
  * - You need both dates and times; \Date handles only dates.
9524
9526
  * - You need only Gregorian dates (and not Julian dates);
9525
- * see {Julian and Gregorian Calendars}[rdoc-ref:calendars.rdoc].
9527
+ * see {Julian and Gregorian Calendars}[rdoc-ref:date/calendars.rdoc].
9526
9528
  *
9527
9529
  * A \Date object, once created, is immutable, and cannot be modified.
9528
9530
  *
@@ -122,8 +122,9 @@ do { \
122
122
  do { \
123
123
  size_t l; \
124
124
  l = read_digits(&str[si], slen - si, &n, w); \
125
- if (l == 0) \
125
+ if (l == 0) { \
126
126
  fail(); \
127
+ } \
127
128
  si += l; \
128
129
  } while (0)
129
130
 
data/lib/date.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  require 'date_core'
5
5
 
6
6
  class Date
7
- VERSION = "3.4.1" # :nodoc:
7
+ VERSION = "3.5.0" # :nodoc:
8
8
 
9
9
  # call-seq:
10
10
  # infinite? -> false
metadata CHANGED
@@ -1,23 +1,25 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: date
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.1
4
+ version: 3.5.0
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: 2024-12-02 00:00:00.000000000 Z
11
+ date: 2025-10-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: A subclass of Object includes Comparable module for handling dates.
13
+ description: The official date library for Ruby.
14
14
  email:
15
- -
15
+ -
16
16
  executables: []
17
17
  extensions:
18
18
  - ext/date/extconf.rb
19
19
  extra_rdoc_files: []
20
20
  files:
21
+ - BSDL
22
+ - COPYING
21
23
  - README.md
22
24
  - ext/date/date_core.c
23
25
  - ext/date/date_parse.c
@@ -35,7 +37,7 @@ licenses:
35
37
  - BSD-2-Clause
36
38
  metadata:
37
39
  changelog_uri: https://github.com/ruby/date/releases
38
- post_install_message:
40
+ post_install_message:
39
41
  rdoc_options: []
40
42
  require_paths:
41
43
  - lib
@@ -50,8 +52,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
50
52
  - !ruby/object:Gem::Version
51
53
  version: '0'
52
54
  requirements: []
53
- rubygems_version: 3.5.11
54
- signing_key:
55
+ rubygems_version: 3.5.22
56
+ signing_key:
55
57
  specification_version: 4
56
- summary: A subclass of Object includes Comparable module for handling dates.
58
+ summary: The official date library for Ruby.
57
59
  test_files: []