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

ruby-changes:51306

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

nobu	2018-05-29 00:19:38 +0900 (Tue, 29 May 2018)

  New Revision: 63512

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

  Log:
    time.rb: fix parsing time zone in iso8601
    
    * lib/time.rb (Time.xmlschema): a colon in time zone designator
      can be omitted.  [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 63511)
+++ test/test_time.rb	(revision 63512)
@@ -105,6 +105,7 @@ class TestTimeExtension < Test::Unit::Te https://github.com/ruby/ruby/blob/trunk/test/test_time.rb#L105
     t = Time.utc(1996, 12, 20, 0, 39, 57)
     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)/, '')))
     # 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 63511)
+++ lib/time.rb	(revision 63512)
@@ -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/

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