diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb index 9c9f26047f..2afbc2adb9 100644 --- a/activesupport/lib/active_support/core_ext/time/calculations.rb +++ b/activesupport/lib/active_support/core_ext/time/calculations.rb @@ -42,8 +42,8 @@ class Time # Layers additional behavior on Time.at so that ActiveSupport::TimeWithZone and DateTime # instances can be used when called with a single argument - def at_with_coercion(*args) - return at_without_coercion(*args) if args.size != 1 + def at_with_coercion(*args, **kwargs) + return at_without_coercion(*args, **kwargs) if args.size != 1 || !kwargs.empty? # Time.at can be called with a time or numerical value time_or_number = args.first diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb index 31d33ca383..10ef69bd60 100644 --- a/activesupport/test/core_ext/time_ext_test.rb +++ b/activesupport/test/core_ext/time_ext_test.rb @@ -919,6 +919,10 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase end end + def test_at_with_in_option + assert_equal Time.new(1970, 1, 1, 0, 42, 17, "-08:00"), Time.at(31337, in: -28800) + end + def test_at_with_time_with_zone_returns_local_time with_env_tz "US/Eastern" do twz = ActiveSupport::TimeWithZone.new(Time.utc(2000, 1, 1, 0, 0, 0), ActiveSupport::TimeZone["London"])