将RRULE解析为可读文本? [英] Parse RRULE to readable text?

查看:335
本文介绍了将RRULE解析为可读文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am looking for a library (php) or some pseudocode to parse Ical RRULEs to readable text(like for example google calendar)

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

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


推荐答案

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

I was wondering the same thing and I struggled to find one, but I found one which is still in development, and you can find it here: 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);

我相信它还不完美,我想它在开发中还在变化,但看起来很有前途。

I believe it's not perfect yet and I guess it's still changing while in dev, but looks very promising.

这篇关于将RRULE解析为可读文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆