diff options
author | Henrik Nyh and Tomas Skogberg <[email protected]> | 2020-04-20 16:10:37 +0100 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2020-05-23 09:43:05 +0900 |
commit | fdb31aa7ab1bb1718e57e2e052caff959af3111e () | |
tree | e3392009487094b0714cf5a4f3ad41e34558d984 /lib | |
parent | da484c3187523a7cf35130f64783b431a61004a6 (diff) |
Time.xmlschema: Clarify error and docs
It parses a (date)time, not a date.
Notes: Merged: https://.com/ruby/ruby/pull/3046
-rw-r--r-- | lib/time.rb | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -590,12 +590,12 @@ class Time end # - # Parses +date+ as a dateTime defined by the XML Schema and converts it to # a Time object. The format is a restricted version of the format defined # by ISO 8601. # - # ArgumentError is raised if +date+ is not compliant with the format or if - # the Time class cannot represent specified date. # # See #xmlschema for more information on this format. # @@ -606,14 +606,14 @@ class Time # # You must require 'time' to use this method. # - def xmlschema(date) if /\A\s* (-?\d+)-(\d\d)-(\d\d) T (\d\d):(\d\d):(\d\d) (\.\d+)? (Z|[+-]\d\d(?::?\d\d)?)? - \s*\z/ix =~ date year = $1.to_i mon = $2.to_i day = $3.to_i @@ -636,7 +636,7 @@ class Time self.local(year, mon, day, hour, min, sec, usec) end else - raise ArgumentError.new("invalid date: #{date.inspect}") end end alias iso8601 xmlschema |