summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/ruby/test_time.rb1
-rw-r--r--timev.rb6
2 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb
index 45439be995..2a541bbe8c 100644
--- a/test/ruby/test_time.rb
+++ b/test/ruby/test_time.rb
@@ -77,6 +77,7 @@ class TestTime < Test::Unit::TestCase
assert_equal(Time.new(2021), Time.new("2021"))
assert_equal(Time.new(2021, 12, 25, in: "+09:00"), Time.new("2021-12-25+09:00"))
+ assert_equal(Time.new(2021, 12, 25, in: "+09:00"), Time.new("2021-12-25+09:00", in: "-01:00"))
assert_equal(0.123456r, Time.new("2021-12-25 00:00:00.123456 +09:00").subsec)
assert_equal(0.123456789r, Time.new("2021-12-25 00:00:00.123456789876 +09:00").subsec)
diff --git a/timev.rb b/timev.rb
index 28e0a444b1..db3a1925ce 100644
--- a/timev.rb
+++ b/timev.rb
@@ -380,6 +380,12 @@ class Time
# Time.new(in: '-12:00')
# # => 2022-08-23 08:49:26.1941467 -1200
#
+ # Since +in:+ keyword argument just provides the default, so if the
+ # first argument in single string form contains time zone information,
+ # this keyword argument will be silently ignored.
+ #
+ # Time.new('2000-01-01 00:00:00 +0100', in: '-0500').utc_offset # => 3600
+ #
# - +precision+: maximum effective digits in sub-second part, default is 9.
# More digits will be truncated, as other operations of \Time.
# Ignored unless the first argument is a string.