DateTime::Event::ICal(3pm)

DateTime::Event::ICal3pm

Perl datetime extension for computing rfc2445 recurrences.

Usage

 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;
 }

Overview

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 );

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.

•

dtstart

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".

•

until

A DateTime object which specifies the recurrence's end date. Can also be specified as "dtend".

•

count

A positive number which indicate the total number of recurrences. Giving both a "count" and an "until" parameter is pointless, though it is currently allowed.

•

freq

One of:

   "yearly", "monthly", "weekly", "daily",
   "hourly", "minutely", "secondly"

See the "DateTime::Event::Recurrence" documentation for more details on what these mean.

•

interval

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.

•

wkst

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

•

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

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.

•

byday => [ list ]

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.

•

bymonthday => [ list ], byyearday => [ list ]

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.

•

byweekno => [ list ]

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.

•

bymonth => [ list ]

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.

•

bysetpos => [ list ]

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 conjunction with one of the other "by..." parameters.

See RFC 2445, section 4.3.10 for more details.

Credits

The API was developed with help from the people in the [email protected] list.

Releases

9 releases since Debian 6.0 (Squeeze); the text changed 4 times.

  1. 6.0–7
  2. 8
  3. 9–11
  4. 12–13
  5. Arch

Author

Flavio Soibelmann Glock [email protected]

From perl-datetime-event-ical 0.13-13 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.