[前][次][番号順一覧][スレッド一覧]

ruby-changes:51308

From: nobu <ko1@a...>
Date: Tue, 29 May 2018 00:35:13 +0900 (JST)
Subject: [ruby-changes:51308] nobu:r63514 (trunk): time.rb: fix parsing time zone in iso8601

nobu	2018-05-29 00:35:08 +0900 (Tue, 29 May 2018)

  New Revision: 63514

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63514

  Log:
    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]

  Modified files:
    trunk/lib/time.rb
    trunk/test/test_time.rb
Index: test/test_time.rb
===================================================================
--- test/test_time.rb	(revision 63513)
+++ test/test_time.rb	(revision 63514)
@@ -106,6 +106,7 @@ class TestTimeExtension < Test::Unit::Te https://github.com/ruby/ruby/blob/trunk/test/test_time.rb#L106
     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))
Index: lib/time.rb
===================================================================
--- lib/time.rb	(revision 63513)
+++ lib/time.rb	(revision 63514)
@@ -571,7 +571,7 @@ class Time https://github.com/ruby/ruby/blob/trunk/lib/time.rb#L571
           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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]