Loading lib/WWW/Efa.pm +14 −4 Original line number Diff line number Diff line Loading @@ -78,14 +78,24 @@ sub post_time { sub post_date { my ($post, $date) = @_; my ($day, $month, $year) = split(/\./, $date); if ($date !~ /^ [0-3]? \d \. [01]? \d (?: | \. | \. (?: \d{4} ))? $/x) { if (not defined $day or not length($day) or $day < 1 or $day > 31) { die WWW::Efa::Error::Setup->new( 'date', $date, 'Must match DD.MM.[YYYY]' 'date', $date, 'Invalid day' ); } @{$post}{'itdDateDay', 'itdDateMonth', 'itdDateYear'} = split(/\./, $date); $post->{'itdDateYear'} //= (localtime(time))[5] + 1900; if (not defined $month or not length($month) or $month < 1 or $month > 12) { die WWW::Efa::Error::Setup->new( 'date', $date, 'Invalid month' ); } if (not defined $year or not length($year)) { $year = (localtime(time))[5] + 1900; } @{$post}{'itdDateDay', 'itdDateMonth', 'itdDateYear'} = ($day, $month, $year); } sub post_exclude { Loading t/50-www-efa.t +2 −2 Original line number Diff line number Diff line Loading @@ -153,12 +153,12 @@ is_efa_post( is_efa_err( 'date', '42.5.2003', 'Must match DD.MM.[YYYY]' 'Invalid day', ); is_efa_err( 'date', '7.', 'Must match DD.MM.[YYYY]' 'Invalid month', ); is_efa_post( Loading t/60-bin-efa.t +1 −1 Original line number Diff line number Diff line Loading @@ -120,7 +120,7 @@ for my $opt (qw/-d --date/) { $cmd->exit_isnt_num(0); $cmd->stdout_is_eq($EMPTY); $cmd->stderr_is_eq( mk_err('date', '11.23.2010', 'Must match DD.MM.[YYYY]') mk_err('date', '11.23.2010', 'Invalid month') ); } Loading Loading
lib/WWW/Efa.pm +14 −4 Original line number Diff line number Diff line Loading @@ -78,14 +78,24 @@ sub post_time { sub post_date { my ($post, $date) = @_; my ($day, $month, $year) = split(/\./, $date); if ($date !~ /^ [0-3]? \d \. [01]? \d (?: | \. | \. (?: \d{4} ))? $/x) { if (not defined $day or not length($day) or $day < 1 or $day > 31) { die WWW::Efa::Error::Setup->new( 'date', $date, 'Must match DD.MM.[YYYY]' 'date', $date, 'Invalid day' ); } @{$post}{'itdDateDay', 'itdDateMonth', 'itdDateYear'} = split(/\./, $date); $post->{'itdDateYear'} //= (localtime(time))[5] + 1900; if (not defined $month or not length($month) or $month < 1 or $month > 12) { die WWW::Efa::Error::Setup->new( 'date', $date, 'Invalid month' ); } if (not defined $year or not length($year)) { $year = (localtime(time))[5] + 1900; } @{$post}{'itdDateDay', 'itdDateMonth', 'itdDateYear'} = ($day, $month, $year); } sub post_exclude { Loading
t/50-www-efa.t +2 −2 Original line number Diff line number Diff line Loading @@ -153,12 +153,12 @@ is_efa_post( is_efa_err( 'date', '42.5.2003', 'Must match DD.MM.[YYYY]' 'Invalid day', ); is_efa_err( 'date', '7.', 'Must match DD.MM.[YYYY]' 'Invalid month', ); is_efa_post( Loading
t/60-bin-efa.t +1 −1 Original line number Diff line number Diff line Loading @@ -120,7 +120,7 @@ for my $opt (qw/-d --date/) { $cmd->exit_isnt_num(0); $cmd->stdout_is_eq($EMPTY); $cmd->stderr_is_eq( mk_err('date', '11.23.2010', 'Must match DD.MM.[YYYY]') mk_err('date', '11.23.2010', 'Invalid month') ); } Loading