date 3.3.3 → 3.4.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: 6ccf42407789dcdf94598ab68332e1860f4f2b5f5820d7b2b2bd8ae283088160
4
- data.tar.gz: 988c7bded5cb20a4b68283216eeaaddf874a15765705919fe372bdeaf58d1c2a
3
+ metadata.gz: 663deb4b7503aa59db5242f38e54b0e00072a41715555d584171f1b49423d898
4
+ data.tar.gz: 7c59321afa979e6823fe7e5ee93dd4a558822a4b9fb2406d8c0c440a7db3d869
5
5
  SHA512:
6
- metadata.gz: f99b7157afc55d925ffe6ea0f786ce4dc377a30786bb8045b71019db65cd056c83edbd4a979925060ed0daaae2f0cc71f19c04d0b89df53b6a39c70ad6005457
7
- data.tar.gz: d4d955554151f00b3e0db05cf684d5e7c47655654fd3174aa3e1c67b14a9fa8696092219eac5e540ae9d9abe8c05b06e13bb4ff74c754c33b7e075e9b5498597
6
+ metadata.gz: 28d17ce123b257d3b5983104040709f96d6c0abeb5e431678e83a3e41148630857d96e130451fd6ecf77a3d9a19bd7dac08479ca3d5350c0157adfc009b4b48d
7
+ data.tar.gz: 6f1ae004dd42e1e566e59371009b128ada23a76fd2dafa0384cb50fffeb84be0791f1d1e06916eebd31c1708d9d4026bc987f94cc5bb5e895c9200bf7e7c1907
data/ext/date/date_core.c CHANGED
@@ -57,7 +57,7 @@ static VALUE sym_hour, sym_min, sym_sec, sym_sec_fraction, sym_zone;
57
57
  #define f_add3(x,y,z) f_add(f_add(x, y), z)
58
58
  #define f_sub3(x,y,z) f_sub(f_sub(x, y), z)
59
59
 
60
- #define f_frozen_ary(...) rb_obj_freeze(rb_ary_new3(__VA_ARGS__))
60
+ #define f_frozen_ary(...) rb_ary_freeze(rb_ary_new3(__VA_ARGS__))
61
61
 
62
62
  static VALUE date_initialize(int argc, VALUE *argv, VALUE self);
63
63
  static VALUE datetime_initialize(int argc, VALUE *argv, VALUE self);
@@ -2589,8 +2589,6 @@ date_s__valid_civil_p(int argc, VALUE *argv, VALUE klass)
2589
2589
  *
2590
2590
  * See argument {start}[rdoc-ref:calendars.rdoc@Argument+start].
2591
2591
  *
2592
- * Date.valid_date? is an alias for Date.valid_civil?.
2593
- *
2594
2592
  * Related: Date.jd, Date.new.
2595
2593
  */
2596
2594
  static VALUE
@@ -2986,8 +2984,6 @@ date_s_julian_leap_p(VALUE klass, VALUE y)
2986
2984
  * Date.gregorian_leap?(2000) # => true
2987
2985
  * Date.gregorian_leap?(2001) # => false
2988
2986
  *
2989
- * Date.leap? is an alias for Date.gregorian_leap?.
2990
- *
2991
2987
  * Related: Date.julian_leap?.
2992
2988
  */
2993
2989
  static VALUE
@@ -3493,8 +3489,6 @@ date_s_civil(int argc, VALUE *argv, VALUE klass)
3493
3489
  *
3494
3490
  * See argument {start}[rdoc-ref:calendars.rdoc@Argument+start].
3495
3491
  *
3496
- * Date.civil is an alias for Date.new.
3497
- *
3498
3492
  * Related: Date.jd.
3499
3493
  */
3500
3494
  static VALUE
@@ -4470,12 +4464,6 @@ check_limit(VALUE str, VALUE opt)
4470
4464
  {
4471
4465
  size_t slen, limit;
4472
4466
  if (NIL_P(str)) return;
4473
- if (SYMBOL_P(str)) {
4474
- rb_category_warn(RB_WARN_CATEGORY_DEPRECATED,
4475
- "The ability to parse Symbol is an unintentional bug and is deprecated");
4476
- str = rb_sym2str(str);
4477
- }
4478
-
4479
4467
  StringValue(str);
4480
4468
  slen = RSTRING_LEN(str);
4481
4469
  limit = get_limit(opt);
@@ -4832,8 +4820,6 @@ date_s_xmlschema(int argc, VALUE *argv, VALUE klass)
4832
4820
  *
4833
4821
  * See argument {limit}[rdoc-ref:Date@Argument+limit].
4834
4822
  *
4835
- * Date._rfc822 is an alias for Date._rfc2822.
4836
- *
4837
4823
  * Related: Date.rfc2822 (returns a \Date object).
4838
4824
  */
4839
4825
  static VALUE
@@ -4864,8 +4850,6 @@ date_s__rfc2822(int argc, VALUE *argv, VALUE klass)
4864
4850
  * - Argument {start}[rdoc-ref:calendars.rdoc@Argument+start].
4865
4851
  * - Argument {limit}[rdoc-ref:Date@Argument+limit].
4866
4852
  *
4867
- * Date.rfc822 is an alias for Date.rfc2822.
4868
- *
4869
4853
  * Related: Date._rfc2822 (returns a hash).
4870
4854
  */
4871
4855
  static VALUE
@@ -5346,7 +5330,6 @@ d_lite_yday(VALUE self)
5346
5330
  *
5347
5331
  * Date.new(2001, 2, 3).mon # => 2
5348
5332
  *
5349
- * Date#month is an alias for Date#mon.
5350
5333
  */
5351
5334
  static VALUE
5352
5335
  d_lite_mon(VALUE self)
@@ -5363,7 +5346,6 @@ d_lite_mon(VALUE self)
5363
5346
  *
5364
5347
  * Date.new(2001, 2, 3).mday # => 3
5365
5348
  *
5366
- * Date#day is an alias for Date#mday.
5367
5349
  */
5368
5350
  static VALUE
5369
5351
  d_lite_mday(VALUE self)
@@ -5613,7 +5595,6 @@ d_lite_hour(VALUE self)
5613
5595
  *
5614
5596
  * DateTime.new(2001, 2, 3, 4, 5, 6).min # => 5
5615
5597
  *
5616
- * Date#minute is an alias for Date#min.
5617
5598
  */
5618
5599
  static VALUE
5619
5600
  d_lite_min(VALUE self)
@@ -5630,7 +5611,6 @@ d_lite_min(VALUE self)
5630
5611
  *
5631
5612
  * DateTime.new(2001, 2, 3, 4, 5, 6).sec # => 6
5632
5613
  *
5633
- * Date#second is an alias for Date#sec.
5634
5614
  */
5635
5615
  static VALUE
5636
5616
  d_lite_sec(VALUE self)
@@ -5648,7 +5628,6 @@ d_lite_sec(VALUE self)
5648
5628
  *
5649
5629
  * DateTime.new(2001, 2, 3, 4, 5, 6.5).sec_fraction # => (1/2)
5650
5630
  *
5651
- * Date#second_fraction is an alias for Date#sec_fraction.
5652
5631
  */
5653
5632
  static VALUE
5654
5633
  d_lite_sec_fraction(VALUE self)
@@ -6347,9 +6326,11 @@ minus_dd(VALUE self, VALUE other)
6347
6326
  * call-seq:
6348
6327
  * d - other -> date or rational
6349
6328
  *
6350
- * Returns the difference between the two dates if the other is a date
6351
- * object. If the other is a numeric value, returns a date object
6352
- * pointing +other+ days before self. If the other is a fractional number,
6329
+ * If the other is a date object, returns a Rational
6330
+ * whose value is the difference between the two dates in days.
6331
+ * If the other is a numeric value, returns a date object
6332
+ * pointing +other+ days before self.
6333
+ * If the other is a fractional number,
6353
6334
  * assumes its precision is at most nanosecond.
6354
6335
  *
6355
6336
  * Date.new(2001,2,3) - 1 #=> #<Date: 2001-02-02 ...>
@@ -6424,7 +6405,6 @@ d_lite_prev_day(int argc, VALUE *argv, VALUE self)
6424
6405
  * d.to_s # => "2001-02-03"
6425
6406
  * d.next.to_s # => "2001-02-04"
6426
6407
  *
6427
- * Date#succ is an alias for Date#next.
6428
6408
  */
6429
6409
  static VALUE
6430
6410
  d_lite_next(VALUE self)
@@ -7298,7 +7278,6 @@ strftimev(const char *fmt, VALUE self,
7298
7278
  *
7299
7279
  * See {asctime}[https://linux.die.net/man/3/asctime].
7300
7280
  *
7301
- * Date#ctime is an alias for Date#asctime.
7302
7281
  */
7303
7282
  static VALUE
7304
7283
  d_lite_asctime(VALUE self)
@@ -7316,7 +7295,6 @@ d_lite_asctime(VALUE self)
7316
7295
  *
7317
7296
  * Date.new(2001, 2, 3).iso8601 # => "2001-02-03"
7318
7297
  *
7319
- * Date#xmlschema is an alias for Date#iso8601.
7320
7298
  */
7321
7299
  static VALUE
7322
7300
  d_lite_iso8601(VALUE self)
@@ -7349,7 +7327,6 @@ d_lite_rfc3339(VALUE self)
7349
7327
  *
7350
7328
  * Date.new(2001, 2, 3).rfc2822 # => "Sat, 3 Feb 2001 00:00:00 +0000"
7351
7329
  *
7352
- * Date#rfc822 is an alias for Date#rfc2822.
7353
7330
  */
7354
7331
  static VALUE
7355
7332
  d_lite_rfc2822(VALUE self)
@@ -8745,8 +8722,8 @@ dt_lite_to_s(VALUE self)
8745
8722
  *
8746
8723
  * DateTime.now.strftime # => "2022-07-01T11:03:19-05:00"
8747
8724
  *
8748
- * For other formats, see
8749
- * {Formats for Dates and Times}[doc/strftime_formatting.rdoc].
8725
+ * For other formats,
8726
+ * see {Formats for Dates and Times}[https://docs.ruby-lang.org/en/master/strftime_formatting_rdoc.html]:
8750
8727
  *
8751
8728
  */
8752
8729
  static VALUE
@@ -8980,18 +8957,22 @@ time_to_datetime(VALUE self)
8980
8957
  static VALUE
8981
8958
  date_to_time(VALUE self)
8982
8959
  {
8960
+ VALUE t;
8961
+
8983
8962
  get_d1a(self);
8984
8963
 
8985
8964
  if (m_julian_p(adat)) {
8986
- VALUE tmp = d_lite_gregorian(self);
8987
- get_d1b(tmp);
8965
+ self = d_lite_gregorian(self);
8966
+ get_d1b(self);
8988
8967
  adat = bdat;
8989
8968
  }
8990
8969
 
8991
- return f_local3(rb_cTime,
8970
+ t = f_local3(rb_cTime,
8992
8971
  m_real_year(adat),
8993
8972
  INT2FIX(m_mon(adat)),
8994
8973
  INT2FIX(m_mday(adat)));
8974
+ RB_GC_GUARD(self); /* may be the converted gregorian */
8975
+ return t;
8995
8976
  }
8996
8977
 
8997
8978
  /*
@@ -9080,6 +9061,7 @@ datetime_to_time(VALUE self)
9080
9061
  f_add(INT2FIX(m_sec(dat)),
9081
9062
  m_sf_in_sec(dat)),
9082
9063
  INT2FIX(m_of(dat)));
9064
+ RB_GC_GUARD(self); /* may be the converted gregorian */
9083
9065
  return t;
9084
9066
  }
9085
9067
  }
@@ -9484,7 +9466,7 @@ mk_ary_of_str(long len, const char *a[])
9484
9466
  }
9485
9467
  rb_ary_push(o, e);
9486
9468
  }
9487
- rb_obj_freeze(o);
9469
+ rb_ary_freeze(o);
9488
9470
  return o;
9489
9471
  }
9490
9472
 
@@ -7,6 +7,9 @@
7
7
  #include "ruby/re.h"
8
8
  #include <ctype.h>
9
9
 
10
+ #undef strncasecmp
11
+ #define strncasecmp STRNCASECMP
12
+
10
13
  RUBY_EXTERN VALUE rb_int_positive_pow(long x, unsigned long y);
11
14
  RUBY_EXTERN unsigned long ruby_scan_digits(const char *str, ssize_t len, int base, size_t *retlen, int *overflow);
12
15
 
@@ -7,6 +7,9 @@
7
7
  #include "ruby/re.h"
8
8
  #include <ctype.h>
9
9
 
10
+ #undef strncasecmp
11
+ #define strncasecmp STRNCASECMP
12
+
10
13
  static const char *day_names[] = {
11
14
  "Sunday", "Monday", "Tuesday", "Wednesday",
12
15
  "Thursday", "Friday", "Saturday",
data/ext/date/prereq.mk CHANGED
@@ -1,7 +1,7 @@
1
1
  .SUFFIXES: .list
2
2
 
3
3
  .list.h:
4
- gperf --ignore-case -C -c -P -p -j1 -i 1 -g -o -t -N $(*F) $< \
4
+ gperf --ignore-case -L ANSI-C -C -c -P -p -j1 -i 1 -g -o -t -N $(*F) $< \
5
5
  | sed -f $(top_srcdir)/tool/gperf.sed \
6
6
  > $(@F)
7
7