P
Paul McMahon
It seems that cannot store instances of DateTime, but instead stores the=
m =
as Time.
irb(main):001:0> require "yaml"
=3D> true
irb(main):003:0> YAML.load(DateTime.now.to_yaml).class
=3D> Time
This causes issues when you have a DateTime that is out of range of Time=
irb(main):005:0> date_time =3D DateTime.new(2041,1,1)
=3D> #<DateTime: 4933041/2,0,2299161>
irb(main):006:0> YAML.load(date_time.to_yaml)
ArgumentError: time out of range
from /usr/local/lib/ruby/1.8/yaml.rb:133:in `utc'
from /usr/local/lib/ruby/1.8/yaml.rb:133:in `node_import'
from /usr/local/lib/ruby/1.8/yaml.rb:133:in `load'
from /usr/local/lib/ruby/1.8/yaml.rb:133:in `load'
from (irb):6
Does anyone have a fix or workaround for this?
Thanks,
Paul McMahon
m =
as Time.
irb(main):001:0> require "yaml"
=3D> true
irb(main):003:0> YAML.load(DateTime.now.to_yaml).class
=3D> Time
This causes issues when you have a DateTime that is out of range of Time=
irb(main):005:0> date_time =3D DateTime.new(2041,1,1)
=3D> #<DateTime: 4933041/2,0,2299161>
irb(main):006:0> YAML.load(date_time.to_yaml)
ArgumentError: time out of range
from /usr/local/lib/ruby/1.8/yaml.rb:133:in `utc'
from /usr/local/lib/ruby/1.8/yaml.rb:133:in `node_import'
from /usr/local/lib/ruby/1.8/yaml.rb:133:in `load'
from /usr/local/lib/ruby/1.8/yaml.rb:133:in `load'
from (irb):6
Does anyone have a fix or workaround for this?
Thanks,
Paul McMahon