What's the best way to iterate over Mondays, Tuesdays, and Thursdays between two dates?I checked the site and list archives but found nothing. My hunch is:
my $days = DateTime::Event::Recurrence->weekly( days => [1,2,4], start=>$DT1); my $iter = $days->iterator; while( (my $day = $iter->next) < $DT2 ){ ... } However, it seems it ought to be possible to use some simple combination of modules (that eludes me) to handle all the logic. (I like elegant) Also, for the listed FAQ: How do I calculate the number of the week of month the given date lies in? Wouldn't it be easier to simply see what week number the first of the month is? If it's zero return the ISO week number +1, other return the ISO week number. Or is there some subtlety I'm missing? If not, I think this is easier to understand. -- H4sICNoBwDoAA3NpZwA9jbsNwDAIRHumuC4NklvXTOD0KSJEnwU8fHz4Q8M9i3sGzkS7BBrm OkCTwsycb4S3DloZuMIYeXpLFqw5LaMhXC2ymhreVXNWMw9YGuAYdfmAbwomoPSyFJuFn2x8 Opr8bBBidccAAAA= -- MOTD on Sweetmorn, the 63rd of Discord, in the YOLD 3172: ...and grenades are also useful for digging foxholes, removing unwanted shrubbery, unclogging drains... --Axly's Book of Explosives for Pyromaniacs