Subject: | ::Recur Doesnt guard against insane dates |
In the following example, i ask ::Recur to match on the 31st of November each year. This date doesnt exist. The result is that ::Recur->dates() spews warnings forever in a loop.
Perhaps the best behavior is to return nothing, or throw an error when parsing?
---
#/usr/bin/env perl
use warnings;
use strict;
use Date::Manip::Date;
my $freq =
'0*11:0:31:0:0:0';
# Y:M:W:D:H:MN:S
my $start = Date::Manip::Date->new_config(['setdate','now,Australia/Sydney']);
$start->parse('now');
print $start->printf('start %d/%m/%Y %Z'),"\n";
my $end = $start->new('2028-11-22');
print $end->printf('end %d/%m/%Y %Z'),"\n";
my $recur = $start->new_recur();
my $err = $recur->parse($freq);
print $recur->frequency,"\n";
#my $err = $recur->parse($freq,$start,$start,$end);
my @dates = $recur->dates($start,$end);
print $_->printf(' - %d/%m/%Y %Z'),"\n"
for @dates;