Besides the nasty Ubuntu bug, which I was unable to do anything meaningful with, yesterday I also found a small bug in Ruby’s YAML package:
irb(main):004:0> YAML::load('1900-01-01T00:00:00+00:00')
ArgumentError: time out of range
The problem is that the YAML implementation that Ruby is using, called “syck” interprets that kind of date as something that it should make a Time
for:
else if ( strcmp( type_id, "timestamp#iso8601" ) == 0 )
{
obj = rb_syck_mktime( n->data.str->ptr, n->data.str->len );
So I did a little bit of hacking on the C code, and made it create a DateTime object instead. My fix works, although I’m not sure it’s the best possible way of tackling the problem. The patch is attached to the bug report here:
http://redmine.ruby-lang.org/issues/show/752
This matters because my Rails text fixtures had some dates in them that were quite old, and this was causing problems.