Subject: | "Jan 10" inconsistent with "January 10" |
Hi Stevan,
Yet another prefer_future weirdness. Collect them all!
my $dtfn = DateTime::Format::Natural->new(prefer_future => 1);
warn $dtfn->parse_datetime("10 Jan")->ymd; # 2007-01-10 (wrong)
warn $dtfn->parse_datetime("10 January")->ymd; # 2008-01-10 (right)
I've looked at the code and it certainly looks like these should be
using the same codepath. But they're obviously not.
In other news, you have the following code in Lang::EN:
%data_months = map {
$_ => $i++
} qw(January February March April May June July August September
October November December);
%data_months_abbrev = map {
substr($_, 0, 3) => $_
} keys %data_months;
my $months_re = join '|', keys %data_months;
my @abbrev = keys %data_months;
$_ = substr($_, 0, 3) foreach @abbrev;
$months_re .= '|' . join '|', @abbrev;
$RE{month} = qr/^($months_re)$/i;
which is doing the same thing (abbreviating month names) twice. You do
the same with weekday names. The second paragraph should probably
become just:
my $months_re = join '|', keys(%data_months),
keys(%data_months_abbrev);
$RE{month} = qr/^($months_re)$/i;
Or (of course) kill the %data_months_abbrev variable and do the
abbreviation with an array.
Thanks!
Shawn