Bugs: Browse | Submit New | Admin

[#12761] Yaml doesn't load large DateTimes

Date:
2007-08-02 02:27
Priority:
3
Submitted By:
Paul McMahon (pwim)
Assigned To:
why the lucky stiff (why)
Category:
Misc / Other Standard Library
State:
Open
Platform:
 
Summary:
Yaml doesn't load large DateTimes

Detailed description
It seems that yaml cannot loading large DateTimes.

irb(main):001:0> require "yaml"
=> true
irb(main):002:0> d = DateTime.parse("2999-12-31T05:59:59Z")
=> #<DateTime: 243370375199/86400,0,2299161>
irb(main):003:0> yaml = d.to_yaml
=> "--- 2999-12-31T05:59:59Z\n"
irb(main):004:0> YAML.load(yaml)
ArgumentError: time out of range
        from /usr/lib/ruby/1.8/yaml.rb:133:in `utc'
        from /usr/lib/ruby/1.8/yaml.rb:133:in `node_import'
        from /usr/lib/ruby/1.8/yaml.rb:133:in `load'
        from /usr/lib/ruby/1.8/yaml.rb:133:in `load'
        from (irb):4

Add A Comment: Notepad

Please login


Followup

Message
Date: 2007-09-12 04:57
Sender: Paul McMahon

This bug is caused by yaml storing DateTime as Time.

irb(main):001:0> require "yaml"
=> true
irb(main):003:0> YAML.load(DateTime.now.to_yaml).class
=> Time

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

Field Old Value Date By
assigned_toshyouhei2007-11-20 04:39shyouhei