You could use this (untested):

  # specify which day of week
  $recurrence = DateTime::Event::Recurrence->weekly( 
      days => '7' );

  # specify the start and end dates
  $now = DateTime->now;
  $span = DateTime::Span->from_datetimes( 
      start => $now->truncate( to => 'month' ), 
      end =>   $now );

  # count the days
  $count = $recurrence->intersection( $span )->count;

In the current implementation this is not efficient for large spans,
because it will make a list of all dates before counting.

- Flavio S. Glock

Reply via email to