time.rb: fix parsing time zone in iso8601

* lib/time.rb (Time.xmlschema): the minute in time zone designator
  can be omitted together with the preceding colon.
  [ruby-core:87277] [Bug #14790]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-05-28 15:35:08 +00:00
Родитель 7b4671f030
Коммит dc2a979b7f
2 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -571,7 +571,7 @@ class Time
T
(\d\d):(\d\d):(\d\d)
(\.\d+)?
(Z|[+-]\d\d:?\d\d)?
(Z|[+-]\d\d(?::?\d\d)?)?
\s*\z/ix =~ date
year = $1.to_i
mon = $2.to_i

Просмотреть файл

@ -106,6 +106,7 @@ class TestTimeExtension < Test::Unit::TestCase # :nodoc:
s = "1996-12-19T16:39:57-08:00"
assert_equal(t, Time.__send__(method, s))
assert_equal(t, Time.__send__(method, s.sub(/:(?=00\z)/, '')))
assert_equal(t, Time.__send__(method, s.sub(/:00\z/, '')))
# There is no way to generate time string with arbitrary timezone.
s = "1996-12-20T00:39:57Z"
assert_equal(t, Time.__send__(method, s))