From 603b64dded557e703408c09499f99c015e7e6b99 Mon Sep 17 00:00:00 2001 From: Jerry Cheung Date: Wed, 14 Aug 2024 12:22:03 -0700 Subject: [PATCH] cast date to Time.zone Fixes failing test test_date_current_same_as_date_today_with_time_zone --- lib/timecop/time_stack_item.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/timecop/time_stack_item.rb b/lib/timecop/time_stack_item.rb index ef49150..0767f71 100644 --- a/lib/timecop/time_stack_item.rb +++ b/lib/timecop/time_stack_item.rb @@ -96,7 +96,9 @@ def scaled_time end def date(date_klass = Date) - date_klass.jd(time.__send__(:to_date).jd) + t = time + t = t.respond_to?(:in_time_zone) ? t.in_time_zone : t + date_klass.jd(t.__send__(:to_date).jd) end def datetime(datetime_klass = DateTime)