0.0103 2003-11-06
- start, end, to_span
- requires DateTime::Set 0.1401
Now you can do this:
$dti = DateTime::Incomplete->new( year => 2004 );
print "Starts in ",
$dti->start->datetime,
", ends in ",
$dti->end->datetime;
# Starts in 2004-01-01T00:00:00, ends in
2005-01-01T00:00:00
$span = $dti->to_span;
print "Duration is ",
"@{[ $span->duration->deltas ]}";
# ... seconds 31622400 nanoseconds 0
print "ICal ",
DateTime::Format::ICal->format_period(
$span );
# ICal 20040101Z/20050101Z
If you installed the latest
DateTime::Event::Recurrence, this will also work:
$dti = DateTime::Incomplete->new(
month => 12 );
$dti->truncate( to => month );
print "ICal ",
DateTime::Format::ICal->format_recurrence(
$dti->to_recurrence );
# ICal
RRULE:FREQ=YEARLY;BYMONTH=12;BYMONTHDAY=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0
:)
- Flavio S. Glock