Skip to content

Commit

Permalink
preserve the timezone of time_object with ActiveSupport >= 7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
nehresma committed Dec 13, 2024
1 parent 4b49e03 commit b34ff7b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/icalendar/recurrence/time_util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ def to_time(time_object, options = {})
if supported_time_object?(time_object)
time_object
elsif supported_icalendar_object?(time_object)
time_object.value
if !defined?(ActiveSupport) || Gem::Version.new(ActiveSupport::VERSION::STRING) < Gem::Version.new('7.2')
time_object.value
else
# Preserve the timezone of the time_object
time_object.value.to_time.in_time_zone(time_object.value.time_zone)
end
elsif supported_datetime_object?(time_object)
datetime_to_time(time_object, options)
elsif supported_date_object?(time_object)
Expand Down

0 comments on commit b34ff7b

Please sign in to comment.