Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Core Extension String#to_datetime ignores time zone

#2651

When calling to_datetime on a string like "2009-05-15T09:51:33+02:00", the time zone is currently ignored.

>> "2009-05-15T09:51:33+02:00".to_datetime.xmlschema
=> "2009-05-15T09:51:33+00:00"

This breaks, as of Ruby 1.8, the standard lib in lib/ruby/1.8/xsd/datatypes.rb:

561  def screen_data(t)
562    # convert t to a DateTime as an internal representation.
563    if t.respond_to?(:to_datetime)      # 1.9 or later
564      t.to_datetime
565    elsif t.is_a?(DateTime)
566      t

Patch with tests is attached.

Kind regards
Christoph Petschnig

Reported by Christoph Petschnig · May 15th, 2009 @ 09:29 AM

State: resolved
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Christoph Petschnig
    Christoph Petschnig

    As I have seen in edge rails, this ticket is solved and therefors obsolete. Thanks!

    July 9th, 2009 @ 03:00 PM

  2. Michael Koziarski
    Michael Koziarski
    • State changed from new to resolved

    August 3rd, 2009 @ 06:09 AM