Skip to content

Time.rfc3339 error message says "invalid xmlschema format" #80

Description

@yahonda

Time.rfc3339 on master (tested at b126827) reports an invalid string as an invalid xmlschema.

Steps to reproduce

require "bundler/inline"

gemfile(true) do
  source "https://rubygems.org"
  gem "time", github: "ruby/time"
end

require "time"

Time.rfc3339("foobar")

Expected behavior

The ArgumentError message names RFC 3339, the format Time.rfc3339 is documented to parse.

Actual behavior

lib/time.rb:677:in 'Time._xmlschema': invalid xmlschema format: "foobar" (ArgumentError)

The message is hardcoded in the _xmlschema helper the pattern is handed to:

raise ArgumentError.new("invalid xmlschema format: #{time.inspect}")

References

  • Time.iso8601 raises the same message, which is consistent with its documentation: iso8601 is an explicit alias of xmlschema (
    alias iso8601 xmlschema
    )
  • Time.rfc3339 is a separate method documented as parsing RFC 3339 (
    def rfc3339(time)
    ), so the format name in the message does not match what was parsed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions