1DateTime::Event::ICal(3U)ser Contributed Perl DocumentatiDoanteTime::Event::ICal(3)
2
3
4
6 DateTime::Event::ICal - Perl DateTime extension for computing rfc2445
7 recurrences.
8
10 use DateTime;
11 use DateTime::Event::ICal;
12
13 my $dt = DateTime->new( year => 2000,
14 month => 6,
15 day => 20,
16 );
17
18 my $set = DateTime::Event::ICal->recur(
19 dtstart => $dt,
20 freq => 'daily',
21 bymonth => [ 10, 12 ],
22 byhour => [ 10 ]
23 );
24
25 my $dt_next = $set->next( $dt );
26
27 my $dt_previous = $set->previous( $dt );
28
29 my $bool = $set->contains( $dt );
30
31 my @days = $set->as_list( start => $dt1, end => $dt2 );
32
33 my $iter = $set->iterator;
34
35 while ( my $dt = $iter->next ) {
36 print ' ', $dt->datetime;
37 }
38
40 This module provides convenience methods that let you easily create
41 "DateTime::Set" objects for rfc2445 style recurrences.
42
44 recur
45 This method returns a "DateTime::Set" object representing the given
46 recurrence.
47
48 my $set = DateTime::Event::ICal->recur( %args );
49
50 This method takes parameters which correspond to the rule parts
51 specified in section 4.3.10 of RFC 2445. Rather than rewrite that
52 RFC here, you are encouraged to read that first if you want to
53 understand what all these parameters represent.
54
55 * dtstart
56 A DateTime object, which is the start date.
57
58 This datetime is not included in the recurrence, unless it sat‐
59 isfies the recurrence's rules.
60
61 A set can thus be used for creating exclusion rules (rfc2445
62 "exrule"), which don't include "dtstart".
63
64 * until
65 A DateTime object which specifies the recurrence's end date.
66 Can also be specified as "dtend".
67
68 * count
69 A positive number which indicate the total number of recur‐
70 rences. Giving both a "count" and an "until" parameter is
71 pointless, though it is currently allowed.
72
73 * freq
74 One of:
75
76 "yearly", "monthly", "weekly", "daily",
77 "hourly", "minutely", "secondly"
78
79 See the "DateTime::Event::Recurrence" documentation for more
80 details on what these mean.
81
82 * interval
83 The interval between recurrences. This is a multiplier for the
84 value specified by "freq". It defaults to 1.
85
86 So if you specify a "freq" of "yearly" and an "interval" of 3,
87 that means a recurrence that occurs every three years.
88
89 * wkst
90 Week start day. This can be one of: "mo", "tu", "we", "th",
91 "fr", "sa", "su". The default is monday ("mo").
92
93 Note: this parameter is not yet implemented
94
95 * bysecond => [ list ], byminute => [ list ], byhour => [ list ]
96 This should be one or more positive or numbers, specified as a
97 scalar or array reference. Each number represents a sec‐
98 ond/minute/hour.
99
100 See RFC 2445, section 4.3.10 for more details.
101
102 * byday => [ list ]
103 This should be a scalar or array reference containing days of
104 the week, specified as "mo", "tu", "we", "th", "fr", "sa", "su"
105
106 The day of week may have a prefix:
107
108 "1tu", # the first tuesday of month or year
109 "-2we" # the second to last wednesday of month or year
110
111 See RFC 2445, section 4.3.10 for more details.
112
113 * bymonthday => [ list ], byyearday => [ list ]
114 A scalar or array reference containing positive or negative
115 numbers, but not zero. For "bymonthday", the allowed ranges
116 are -31 to -1. For "byyearday", the allowed ranges are -366 to
117 -1, and 1 to 366.
118
119 Day -1 is last day of month or year.
120
121 See RFC 2445, section 4.3.10 for more details.
122
123 * byweekno => [ list ]
124 A scalar or array reference containing positive or negative
125 numbers, but not zero. The allowed ranges are -53 to -1, and 1
126 to 53.
127
128 The first week of year is week 1.
129
130 The default week start day is monday.
131
132 Week -1 is the last week of year.
133
134 See RFC 2445, section 4.3.10 for more details.
135
136 * bymonth => [ list ]
137 A scalar or array reference containing positive or negative
138 numbers, from -12 to -1 and 1 to 12.
139
140 Month -1 is December.
141
142 See RFC 2445, section 4.3.10 for more details.
143
144 * bysetpos => [ list ]
145 This can be either a scalar or an array reference of positive
146 and negative numbers from -366 to -1, and 1 to 366. This
147 parameter is used in conjuction with one of the other "by..."
148 parameters.
149
150 See RFC 2445, section 4.3.10 for more details.
151
153 Flavio Soibelmann Glock fglock@pucrs.br
154
156 The API was developed with help from the people in the date‐
157 time@perl.org list.
158
160 Copyright (c) 2003 Flavio Soibelmann Glock. All rights reserved. This
161 program is free software; you can redistribute it and/or modify it
162 under the same terms as Perl itself.
163
164 The full text of the license can be found in the LICENSE file included
165 with this module.
166
168 datetime@perl.org mailing list
169
170 DateTime Web page at http://datetime.perl.org/
171
172 DateTime
173
174 DateTime::Event::Recurrence - simple rule-based recurrences
175
176 DateTime::Format::ICal - can parse rfc2445 recurrences
177
178 DateTime::Set - recurrences defined by callback subroutines
179
180 DateTime::Event::Cron - recurrences defined by "cron" rules
181
182 DateTime::SpanSet
183
184 RFC2445 - Internet Calendaring and Scheduling Core Object Specification
185 - http://www.ietf.org/rfc/rfc2445.txt
186
187
188
189perl v5.8.8 2005-09-30 DateTime::Event::ICal(3)