本文介绍了使用google-rfc-2445(iCalendar)时,在某些情况下会返回开始日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了测试(的Java实现 )。

I ran through a lot of RRULEs just for testing out the performance of google-rfc-2445 (a Java implementation of IETF RFC 2445 iCalendar).

我看到在某些情况下我从方法的返回列表中得到了开始日期。

I saw that I got the start date back in some cases in the returning list from the method.

测试非常简单:

private static void runGoogleTests() throws ParseException
{
    DateTimeZone dtz = DateTimeZone.UTC;
    DateTime dtStart = new DateTime("2014-11-22T00:00:00Z", dtz);//SATURDAY
    DateTimeIterable dti = DateTimeIteratorFactory.createDateTimeIterable("RRULE:FREQ=WEEKLY;COUNT=10;BYDAY=MO", dtStart, dtz, true);

    System.out.println("Size of iterable = " + Iterators.size(dti.iterator()));
    for(DateTime dateTime : dti)
    {
        System.out.println(dateTime);
    }
}

工厂返回的列表返回此列表。

The list returned by the factory returns this list.

第一个日期是开始日期,它是星期六,不应该在那里。 RRULE还包含COUNT = 10,那么为什么返回11?

The first date is the start date and it's a saturday that should not be there. The RRULE also contained a COUNT=10 so why return 11?

Size of iterable = 11
2014-11-22T00:00:00.000Z
2014-11-24T00:00:00.000Z
2014-12-01T00:00:00.000Z
2014-12-08T00:00:00.000Z
2014-12-15T00:00:00.000Z
2014-12-22T00:00:00.000Z
2014-12-29T00:00:00.000Z
2015-01-05T00:00:00.000Z
2015-01-12T00:00:00.000Z
2015-01-19T00:00:00.000Z
2015-01-26T00:00:00.000Z

使用Google-rfc-2445的人之前一定遇到过这个问题吗?

Someone using the Google-rfc-2445 must have encountered this problem before?

我在项目页面上发布了这个问题,但那里非常安静。

I posted the issue on the projects page but it's very quiet there.Link to the issue on google-rfc-2445 page

推荐答案

指定

因此,当存在 DTSTART 时返回的列表是正常的,返回列表的大小是预期的。

so while the presence of the DTSTART in the returned list is normal, what is less expected is the size of the returned list.

鉴于RFC2445规范,使更有意义DTSTART 是第一个重复发生的例子,也可以确保其他日历正确理解ical文件。

Given the RFC2445 specification, it makes more sense to have the DTSTART being the first instance of the recurrence to also insure that other calendars understand the ical file properly.

另外要注意 RFC2445 已被 RFC5545 废弃,它还指定 DTSTART 作为第一个实例 RRULE (甚至强调它,请注意:添加的单词 始终 (empahsis由我添加)

Also to be noted RFC2445 is obsoleted by RFC5545 which also specifies the DTSTART as the first instance of the RRULE (and even emphasizes it, note: the added word always (empahsis added by me)

这篇关于使用google-rfc-2445(iCalendar)时,在某些情况下会返回开始日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-17 02:00
查看更多