Skip to content

Commit

Permalink
cast date to Time.zone
Browse files Browse the repository at this point in the history
Fixes failing test test_date_current_same_as_date_today_with_time_zone
  • Loading branch information
jch committed Aug 14, 2024
1 parent a4f1315 commit 603b64d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/timecop/time_stack_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 603b64d

Please sign in to comment.