DateTime yaml bug

A

Artur Merke

Hi,

does anybody know a quick fix to the DateTime or Yaml bug

YAML::load(DateTime.now.to_yaml).class
=> Time

Thx

Artur
 
A

Artur Merke

Hi,

does anybody know a quick fix to the DateTime or Yaml bug

YAML::load(DateTime.now.to_yaml).class
=> Time

Nobody out there to answer the question? The Problem is
not only, that the class switches to Time, but also that
the read in date is wrong by an week (and the time differs too):
dt= DateTime.now
=> # said:
dt.to_yaml
=> "--- !timestamp 2007-08-28T11:17:35+0200\n"
res= YAML::load(dt.to_yaml)
=> Mon Aug 20 05:17:35 Westeurop ische Normalzeit 2007
res.to_yaml
=> "--- 2007-08-20 05:17:35 +02:00\n"

using Marshal

Marshal.load(Marshal.dump(dt))

gives the right solution (both the class and the data in it are
exactly the same), but I really wanted to stick to yaml ...

Artur
 
E

Eric Hodel

does anybody know a quick fix to the DateTime or Yaml bug

YAML::load(DateTime.now.to_yaml).class
=> Time

Please file a bug in the ruby tracker on RubyForge.

Also:

irb(main):003:0> DateTime.parse '3000/01/01 01:01:01'
=> #<DateTime: 243370443661/86400,0,2299161>
irb(main):004:0> dt = _
=> #<DateTime: 243370443661/86400,0,2299161>
irb(main):005:0> YAML.load dt.to_yaml
ArgumentError: time out of range
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,264
Messages
2,571,323
Members
48,006
Latest member
MelinaLema

Latest Threads

Top