Subject: | ParseDate("April 1625") = 1925041600:00:00 |
Dear Mr. Beck:
First I want to say I love Date::Manip. I found what may or may not be
a problem.
I have been using PERL to process some genealogical data. This means
some dates are partial. The generic behavior of Date::Manip is to
interpolate to the first of the month, interpolate to the first month
of the year, and to interpolate to midnight.
When I use a partial date of month and year such as, April 1625,
Date::Manip parses this string as if the string were April 16, 25.
I expected to get a parsed date of 1625040100:00:00 instead of
1925041600:00:00.
I was surprised by this parsing, but I am not sure I can consider it a
defect. I violated one of the design specs of Date::Manip by not
providing a string which resolves to a particular date.
distribution / perl / os informaiton
Date::Manip: Date-Manip-6.05-EDfANj
Perl: This is perl, v5.10.1 (*) built for i686-linux
OS: Linux Washburn-Ubuntu 2.6.31-16-generic #53-Ubuntu SMP Tue Dec 8
04:01:29 UTC 2009 i686 GNU/Linux
this code
#!/usr/bin/perl -w
use strict;
use Date::Manip;
my @PartialDates = (
"apr. 17, 1625"
,"apr 17 1625"
,"April 17, 1625"
,"April 17, 25"
,"April 1625"
,"Apr 1625"
,"Apr. 1625"
,"1625"
,"25"
,"4/2015" #Like a credit card expiration
);
foreach my $DateString (@PartialDates)
{
my $ParsedDate = ParseDate($DateString);
print "Partial date, $DateString, creates a parsed date of
$ParsedDate.\n"
}
produces this output
Partial date, apr. 17, 1625, creates a parsed date of .
Partial date, apr 17 1625, creates a parsed date of 1625041700:00:00.
Partial date, April 17, 1625, creates a parsed date of 1625041700:00:00.
Partial date, April 17, 25, creates a parsed date of 1925041700:00:00.
Partial date, April 1625, creates a parsed date of 1925041600:00:00.
Partial date, Apr 1625, creates a parsed date of 1925041600:00:00.
Partial date, Apr. 1625, creates a parsed date of .
Partial date, 1625, creates a parsed date of 1625010100:00:00.
Partial date, 25, creates a parsed date of 2500010100:00:00.
Partial date, 4/2015, creates a parsed date of .
As I said a string with partial date is not a date string so it is
difficult to consider this a defect with Date::Manip. I have a work
around at this time for my application. I peek at the date to be
parsed and prepend a 01 if only 2 elements are detected by the split.
This was my motivation for the categorization of unimportant. I am not
providing a true date string and I have a work around.
Thank you again for Date::Manip.
--
In Liberty,
John Washburn