atoomic / perl-TimeDate

time & date parsing and formatting perl library
http://search.cpan.org/dist/TimeDate/
1 stars 3 forks source link

strptime returns negative month for certain inputs [rt.cpan.org #125949] #21

Open atoomic opened 4 years ago

atoomic commented 4 years ago

Migrated from rt.cpan.org#125949 (status was 'new')

Requestors:

From jim.avera@gmail.com on 2018-07-28 20:13:24 :

Hello,

Date::Parse::strptime("199001") returns -1 for the month.  This looks 
like a bug, as the docs say undef should be returned for missing fields 
(or an empty list if the input is not valid).

Actually I was hoping that it would recognize YYYYMM as a partial date 
(with day omitted).
In any case, negative results don't seem right.

Date::Parse Version 2.30

Perl v5.26

perl -MDate::Parse -MData::Dumper -wE 'my @a=strptime("199001"); say 
Dumper(@a);'

$VAR1 = undef;
$VAR2 = undef;
$VAR3 = undef;
$VAR4 = '1';
$VAR5 = -1;
$VAR6 = 90;
$VAR7 = undef;