This project is archived and is in readonly mode.

#2651 ✓resolved
Christoph Petschnig

Core Extension String#to_datetime ignores time zone

Reported by Christoph Petschnig | May 15th, 2009 @ 09:29 AM | in 2.x

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

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Pages