将RRULE解析为可读文本?

时间:2014-02-08 12:44:27

标签: calendar icalendar rfc2445 rfc5545 rrule

我正在寻找一个库(php)或一些伪代码来解析Ical RRULE到可读文本(例如谷歌日历)

RRULE:FREQ=MONTHLY;INTERVAL=1;BYDAY=1FR,3FR,5FR

-> Monthly on Friday of weeks 1, 3, 5 of the month

1 个答案:

答案 0 :(得分:0)

我想知道同样的事情,我努力找到一个,但我找到一个仍在开发中,你可以在这里找到它:https://github.com/simshaun/recurr/tree/v0.2-dev

我能够使用此代码:

$timezone        = 'America/New_York';
$startDate       = new \DateTime('2013-06-12 20:00:00', new \DateTimeZone($timezone));
$rule            = new \Recurr\Rule('FREQ=MONTHLY;COUNT=5', $startDate, $timezone);
$textTransformer = new  \Recurr\Transformer\TextTransformer();
echo $textTransformer->transform($rule);

我认为它还不完美,我猜它在开发时仍然在变化,但看起来很有希望。