Bugs: Browse | Submit New | Admin

[#22629] DateRange to_yaml, YAML::load round-trip fails

Date:
2008-10-31 08:41
Priority:
3
Submitted By:
SiuYin Loh (siuyin)
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
DateRange to_yaml, YAML::load round-trip fails

Detailed description
Illustrated by this script. I'm running runt 0.7.0 as a gem.

#!/usr/bin/env ruby

require 'rubygems'
require 'runt' # this is runt 0.7.0
require 'yaml'

date_range = Runt::DateRange.new(Runt::PDate.civil(2008,1,1),
                                 Runt::PDate.civil(2008,1,3), true)

p date_range.include?(Runt::PDate.civil(2008,1,2,23,59,59) )

s = date_range.to_yaml
yaml_date_range = YAML::load s

p yaml_date_range.include?(Runt::PDate.civil(2008,1,2,23,59,59) )


p date_range.to_yaml
p yaml_date_range.to_yaml

+++++++++++++++++
results of run

true
false
"--- !ruby/range:Runt::DateRange \nbegin: &id002 2008-01-01T00:00:00Z\nend: &id001 2008-01-03T00:00:00Z\nexcl:
true\n\"@end_expr\": *id001\n\"@start_expr\": *id002\n"
"--- !ruby/range:Runt::DateRange \nbegin: &id002 2008-01-01 00:00:00 Z\nend: &id001 2008-01-03 00:00:00
Z\nexcl: true\n\"@end_expr\": *id001\n\"@start_expr\": *id002\n"

+++++++++++++++++
note the times-stamps are missing a T and there is a space preceeding the Z.

Add A Comment: Notepad

Please login


Followup

Message
Date: 2008-10-31 09:19
Sender: SiuYin Loh

I looked at the problem further as it now seems to be a
problem with YAML's handling of DateTime.

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item