DateTi...t::ICal(3pm)
π NAME π
DateTime::Event::ICal β a Perl DateTime extension for computing rfc2445 recurrences. that's the whole vibe, she's a recurrence girlie π¦
πΈ 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;
}
likeβ¦ you build a DateTime, you ask for a recur, and the set it hands back will give you next, previous, contains, as_list, or an iterator to loop over. main character energy fr β¨
π DESCRIPTION π
okay so here's the tea, bestie: this module gives you convenience methods that let you easily build DateTime::Set objects for rfc2445 style recurrences. it's giving "I don't wanna hand-roll recurrence math" and honestly? iconic. π
π¦ USAGE π¦
β¨ recur β¨
this method returns a DateTime::Set object representing the recurrence you asked for. obsessed.
my $set = DateTime::Event::ICal->recur( %args );
it takes parameters that correspond to the rule parts spelled out in section 4.3.10 of RFC 2445. and no, I'm not gonna rewrite that RFC here (imagine π) β you're encouraged to read that first if you actually want to understand what all these parameters represent. iykyk.
dtstartβ aDateTimeobject, and it's the start date. heads up though: this datetime is not included in the recurrence, unless it satisfies the recurrence's rules. so a set can be used for creating exclusion rules (rfc2445 calls it "exrule"), which don't includedtstart. π«Άuntilβ aDateTimeobject that specifies the recurrence's end date. you can also spell itdtend.countβ a positive number indicating the total number of recurrences. giving both acountand anuntilparameter is pointless, though it is currently allowed. so like, you can, but why bestie π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. it's a multiplier for the value specified byfreq, and it defaults to 1. so if you set afreqofyearlyand anintervalof3, that means a recurrence that happens every three years. math is mathing β¨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 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 asmo,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. forbymonthday, the allowed ranges are -31 to -1. forbyyearday, the allowed ranges are -366 to -1, and 1 to 366.
day -1 is the 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. (so yeah, counting backwards from the end of the year, cute right π)
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 otherby...parameters.
see RFC 2445, section 4.3.10 for more details.
π AUTHOR π
Flavio Soibelmann Glock fglock@gmail.com β the literal icon who wrote this π
π CREDITS π
the API was developed with help from the people in the datetime@perl.org list. group project that actually ate, we love to see it π«Ά
π 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
<http://datetime.perl.org/> - The DateTime module.
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
<http://www.ietf.org/rfc/rfc2445.txt>β Internet Calendaring and Scheduling Core Object Specification.
and that's the whole page bestie π this one's living in perl v5.34.0, dated 2022-06-13 β go forth and recur, you absolute DateTime::Event::ICal(3pm) legend πβπ
π¦ where this page comes from
- debian bookworm: libdatetime-event-ical-perl 0.13-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libdatetime-event-ical-perl 0.13-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libdatetime-event-ical-perl 0.13-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdatetime-event-ical-perl 0.13-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdatetime-event-ical-perl 0.13-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms