Subject: | Y2k-like bug causing test suite to fail |
Many tests in t/101_output.t are failing due to what looks like a Y2k
issue. In fact, there is a %y in the long_date_format of the "en"
locale, and Gedcom::Date strips leading zeros, and the year 2003 shows
up as just "3". I'm guessing that the long_date_format used to be
different for this locale, and has broken the test suite for this module.
For my own use, I've added a small bit of code to
DateTime::Gedcom::Simple that fixes the problem, substituting any %y in
long_date_format with %Y. This allows the supplied suite to pass. I
don't want 2-digit years in my genealogy data anyway.
Here's the patch:
*** Gedcom-Date-0.04-orig/lib/Gedcom/Date/Simple.pm 2003-08-31
07:13:23.000000000 -0500
--- Gedcom-Date-0.04-robf/lib/Gedcom/Date/Simple.pm 2009-12-02
13:28:50.000000000 -0600
***************
*** 178,184 ****
$dt->set(locale => $locale);
if ($self->{known}{d}) {
! return $dt->strftime($dt->locale->long_date_format);
} elsif ($self->{known}{m}) {
return $dt->strftime('%B %Y');
} else {
--- 178,186 ----
$dt->set(locale => $locale);
if ($self->{known}{d}) {
! my $format = $dt->locale->long_date_format;
! $format =~ s/%y\b/%Y/g; # never, EVER, use 2-digit years
! return $dt->strftime($format);
} elsif ($self->{known}{m}) {
return $dt->strftime('%B %Y');
} else {