DateTime::Event::ICal - Perl DateTime extension for computing rfc2445 recurrences.
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; }
This module provides convenience methods that let you easily create
DateTime::Set
objects for rfc2445 style recurrences.
This method returns a DateTime::Set
object representing the
given recurrence.
my $set = DateTime::Event::ICal->recur( %args );
This method takes parameters which correspond to the rule parts specified in section 4.3.10 of RFC 2445. Rather than rewrite that RFC here, you are encouraged to read that first if you want to understand what all these parameters represent.
A DateTime object, which is the start date.
This datetime is not included in the recurrence, unless it satisfies the recurrence's rules.
A set can thus be used for creating exclusion rules (rfc2445
exrule
), which don't include dtstart
.
One of:
"yearly", "monthly", "weekly", "daily", "hourly", "minutely", "secondly"
See the DateTime::Event::Recurrence
documentation for more details
on what these mean.
The interval between recurrences. This is a multiplier for the value specified by "freq". It defaults to 1.
So if you specify a "freq" of "yearly" and an "interval" of 3, that means a recurrence that occurs every three years.
Week start day. This can be one of: "mo", "tu", "we", "th", "fr", "sa", "su". The default is monday ("mo").
Note: this parameter is not yet implemented
This should be one or more positive or numbers, specified as a scalar or array reference. Each number represents a second/minute/hour.
See RFC 2445, section 4.3.10 for more details.
This should be a scalar or array reference containing days of the week, specified as "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
See RFC 2445, section 4.3.10 for more details.
A scalar or array reference containing positive or negative numbers, but not zero. For "bymonthday", the allowed ranges are -31 to -1. For "byyearday", the allowed ranges are -366 to -1, and 1 to 366.
Day -1 is last day of month or year.
See RFC 2445, section 4.3.10 for more details.
A scalar or array reference containing positive or negative numbers, but not zero. The allowed ranges are -53 to -1, and 1 to 53.
The first week of year is week 1.
The default week start day is monday.
Week -1 is the last week of year.
See RFC 2445, section 4.3.10 for more details.
A scalar or array reference containing positive or negative numbers, from -12 to -1 and 1 to 12.
Month -1 is December.
See RFC 2445, section 4.3.10 for more details.
This can be either a scalar or an array reference of positive and negative numbers from -366 to -1, and 1 to 366. This parameter is used in conjuction with one of the other "by..." parameters.
See RFC 2445, section 4.3.10 for more details.
Flavio Soibelmann Glock fglock@pucrs.br
The API was developed with help from the people in the datetime@perl.org list.
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.
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