NAME

DateTime::Event::ICal - Perl DateTime extension for computing rfc2445 recurrences.

SYNOPSIS

use DateTime;
use DateTime::Event::ICal;

my $dt = DateTime->new( year   => 2000,
                        month  => 6,
                        day    => 20,
                      );

my $set = DateTime::Event::ICal->recur( 
     dtstart => $dt,
     freq =>    'daily',
     bymonth => [ 10, 12 ],
     byhour =>  [ 10 ]
);

my $dt_next = $set->next( $dt );

my $dt_previous = $set->previous( $dt );

my $bool = $set->contains( $dt );

my @days = $set->as_list( start => $dt1, end => $dt2 );

my $iter = $set->iterator;

while ( my $dt = $iter->next ) {
    print ' ', $dt->datetime;
}

DESCRIPTION

This module provides convenience methods that let you easily create DateTime::Set objects for rfc2445 style recurrences.

USAGE

recur

This method returns a DateTime::Set object representing the given recurrence.

my $set = DateTime::Event::ICal->recur( %args );
  • dtstart

    A DateTime object. Start date.

    dtstart is not included in the recurrence, unless it satisfy the rule.

    The set can thus be used for creating exclusion rules (rfc2445 exrule), which don't include dtstart.

  • dtend

    A DateTime object. End date.

  • freq

    One of:

    'yearly', 'monthly', 'weekly', 'daily', 
    'hourly', 'minutely', 'secondly'
  • until

    A DateTime object. End date.

  • count

    A positive number. Total number of recurrences, after the rule is evaluated.

  • interval

    A positive number, starting in 1. Default is 1.

    Example:

    freq=yearly;interval=2

    events on this recurrence occur each other year.

  • wkst

    Week start day. Default is monday ('mo').

  • bysetpos => [ list ]

    Positive or negative numbers, without zero.

    Example:

    freq=yearly;bysetpos=2 

    inside a yearly recurrence, select 2nd occurence within each year.

  • bysecond => [ list ], byminute => [ list ], byhour => [ list ]

    Positive or negative numbers, including zero.

  • byday => [ list ]

    Day of week: one or more of:

    'mo', 'tu', 'we', 'th', 'fr', 'sa', 'su'

    The day of week may have a prefix:

    '1tu',  # the first tuesday of month or year
    '-2we'  # the second to last wednesday of month or year
  • bymonthday => [ list ], byyearday => [ list ]

    Positive or negative numbers, without zero. Days start in 1.

    Day -1 is last day of month or year.

  • byweekno => [ list ]

    Week number. Positive or negative numbers, without zero. First week of year is week 1.

    Default week start day is monday.

    Week -1 is the last week of year.

  • bymonth => [ list ]

    Months, numbered 1 until 12. Positive or negative numbers, without zero.

    Month -1 is december.

VERSION NOTES

Option wkst is not implemented.

AUTHOR

Flavio Soibelmann Glock fglock@pucrs.br

CREDITS

The API was developed with help from the people in the datetime@perl.org list.

COPYRIGHT

Copyright (c) 2003 Flavio Soibelmann Glock. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO

datetime@perl.org mailing list

DateTime Web page at http://datetime.perl.org/

DateTime

DateTime::Event::Recurrence - simple rule-based recurrences

DateTime::Format::ICal - can parse rfc2445 recurrences

DateTime::Set - recurrences defined by callback subroutines

DateTime::Event::Cron - recurrences defined by 'cron' rules

DateTime::SpanSet

RFC2445 - Internet Calendaring and Scheduling Core Object Specification - http://www.ietf.org/rfc/rfc2445.txt