Hi Nigel
On 30/09/15 00:37, Nigel Horne via RT wrote:
Show quoted text> Queue: Genealogy-Gedcom-Date
> Ticket <URL:
https://rt.cpan.org/Ticket/Display.html?id=107400 >
>
> Try this program. Clearly the input is wrong and so I will fix my Gedcom, however I believe that G:G:D should more gracefully handle the problematic data giving a "Can't parse" error as it does with other errant data.
>
> #!/usr/bin/env perl
>
> use Genealogy::Gedcom::Date;
>
> my $date_parser = Genealogy::Gedcom::Date->new();
>
> $date_parser->parse_date_value(date => 'December 13,1668');
That's meant to fail, and is in the docs :-).
(a) parse_date_value() is documented as not taking a style parameter,
which is what's needed to handle this date.
I may have to expand it the same way I've just expanded
parse_datetime(). See below.
Let me know if you need that. I was distracted by $work and should have
done that in V 1.16.
(b) There was a bug in the code, zapping commas in dates rather than
replacing them with spaces. So, this date is seen as 'December 131668'.
(c) The expansion of parse_datetime() to accept a string or a hash means
it now (with the above bug fix of course) parses your date.
(d) I've expanded t/date.t to test your date.
(e) V 1.16 is now on CPAN.
--
Ron Savage - savage.net.au