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
57 A DateTime object, which is the start date.
58
59 This datetime is not included in the recurrence, unless it
60 satisfies the recurrence's rules.
61
62 A set can thus be used for creating exclusion rules (rfc2445
63 "exrule"), which don't include "dtstart".
64
65 · until
66
67 A DateTime object which specifies the recurrence's end date.
68 Can also be specified as "dtend".
69
70 · count
71
72 A positive number which indicate the total number of
73 recurrences. Giving both a "count" and an "until" parameter is
74 pointless, though it is currently allowed.
75
76 · freq
77
78 One of:
79
80 "yearly", "monthly", "weekly", "daily",
81 "hourly", "minutely", "secondly"
82
83 See the "DateTime::Event::Recurrence" documentation for more
84 details on what these mean.
85
86 · interval
87
88 The interval between recurrences. This is a multiplier for the
89 value specified by "freq". It defaults to 1.
90
91 So if you specify a "freq" of "yearly" and an "interval" of 3,
92 that means a recurrence that occurs every three years.
93
94 · wkst
95
96 Week start day. This can be one of: "mo", "tu", "we", "th",
97 "fr", "sa", "su". The default is Monday ("mo").
98
99 Note: this parameter is not yet implemented
100
101 · bysecond => [ list ], byminute => [ list ], byhour => [ list ]
102
103 This should be one or more positive or numbers, specified as a
104 scalar or array reference. Each number represents a
105 second/minute/hour.
106
107 See RFC 2445, section 4.3.10 for more details.
108
109 · byday => [ list ]
110
111 This should be a scalar or array reference containing days of
112 the week, specified as "mo", "tu", "we", "th", "fr", "sa", "su"
113
114 The day of week may have a prefix:
115
116 "1tu", # the first tuesday of month or year
117 "-2we" # the second to last wednesday of month or year
118
119 See RFC 2445, section 4.3.10 for more details.
120
121 · bymonthday => [ list ], byyearday => [ list ]
122
123 A scalar or array reference containing positive or negative
124 numbers, but not zero. For "bymonthday", the allowed ranges
125 are -31 to -1. For "byyearday", the allowed ranges are -366 to
126 -1, and 1 to 366.
127
128 Day -1 is last day of month or year.
129
130 See RFC 2445, section 4.3.10 for more details.
131
132 · byweekno => [ list ]
133
134 A scalar or array reference containing positive or negative
135 numbers, but not zero. The allowed ranges are -53 to -1, and 1
136 to 53.
137
138 The first week of year is week 1.
139
140 The default week start day is Monday.
141
142 Week -1 is the last week of year.
143
144 See RFC 2445, section 4.3.10 for more details.
145
146 · bymonth => [ list ]
147
148 A scalar or array reference containing positive or negative
149 numbers, from -12 to -1 and 1 to 12.
150
151 Month -1 is December.
152
153 See RFC 2445, section 4.3.10 for more details.
154
155 · bysetpos => [ list ]
156
157 This can be either a scalar or an array reference of positive
158 and negative numbers from -366 to -1, and 1 to 366. This
159 parameter is used in conjunction with one of the other "by..."
160 parameters.
161
162 See RFC 2445, section 4.3.10 for more details.
163
165 Flavio Soibelmann Glock fglock@gmail.com
166
168 The API was developed with help from the people in the
169 datetime@perl.org list.
170
172 Copyright (c) 2003 Flavio Soibelmann Glock. All rights reserved. This
173 program is free software; you can redistribute it and/or modify it
174 under the same terms as Perl itself.
175
176 The full text of the license can be found in the LICENSE file included
177 with this module.
178
180 datetime@perl.org mailing list
181
182 DateTime Web page <http://datetime.perl.org/>
183
184 The DateTime module.
185
186 DateTime::Event::Recurrence - simple rule-based recurrences.
187
188 DateTime::Format::ICal - can parse rfc2445 recurrences.
189
190 DateTime::Set - recurrences defined by callback subroutines.
191
192 DateTime::Event::Cron - recurrences defined by "cron" rules.
193
194 DateTime::SpanSet
195
196 RFC2445 <http://www.ietf.org/rfc/rfc2445.txt> - Internet Calendaring
197 and Scheduling Core Object Specification.
198
199
200
201perl v5.32.0 2020-07-28 DateTime::Event::ICal(3)