diff options
author | Dmitry Dygalo <[email protected]> | 2025-06-15 09:11:01 -0700 |
---|---|---|
committer | git <[email protected]> | 2025-06-15 16:11:06 +0000 |
commit | c1877d431e76f4a782d51602fa8487e98d302956 () | |
tree | e7f2e443da0b7ba8cedec0d62170bb8939f3ee82 | |
parent | 9a840fd2d4c121d91dc822661774761171624fcb (diff) |
[ruby/date] [Bug #21437] Date#hash for large years
Addresses https://bugs.ruby-lang.org/issues/21437 Signed-off-by: Dmitry Dygalo <[email protected]> https://.com/ruby/date/commit/31f07bc576
-rw-r--r-- | ext/date/date_core.c | 21 | ||||
-rw-r--r-- | test/date/test_date.rb | 4 |
2 files changed, 20 insertions, 5 deletions
@@ -6936,13 +6936,24 @@ d_lite_eql_p(VALUE self, VALUE other) static VALUE d_lite_hash(VALUE self) { - st_index_t v, h[4]; get_d1(self); - h[0] = m_nth(dat); - h[1] = m_jd(dat); - h[2] = m_df(dat); - h[3] = m_sf(dat); v = rb_memhash(h, sizeof(h)); return ST2FIX(v); } @@ -135,6 +135,10 @@ class TestDate < Test::Unit::TestCase assert_equal(9, h[DateTime.new(1999,5,25)]) h = {} h[DateTime.new(1999,5,23)] = 0 h[DateTime.new(1999,5,24)] = 1 h[DateTime.new(1999,5,25)] = 2 |