Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yearly recurrences #11

Open
GoogleCodeExporter opened this issue Mar 12, 2015 · 1 comment
Open

Yearly recurrences #11

GoogleCodeExporter opened this issue Mar 12, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Just running this test method : 

    public static void testsICAL(){
        String iCal = "RRULE:FREQ=YEARLY;INTERVAL=2;BYDAY=SA;BYMONTH=9;BYSETPOS=1";

        SimpleDateFormat datePatternUTC = new SimpleDateFormat(DATE_PATTERN_API);
        datePatternUTC.setTimeZone(TimeZone.getTimeZone("UTC"));
        String sDateStart="2013-08-31T06:00:20.000";
        String sDateAdvanceTo="2013-10-01T00:00:00.000";
        Calendar cStart = Calendar.getInstance();
        Calendar cAdvanceTo= Calendar.getInstance();        

        try {
            cStart.setTime(datePatternUTC.parse(sDateStart));
            cAdvanceTo.setTime(datePatternUTC.parse(sDateAdvanceTo));
        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        DateTime start = new DateTime(cStart.getTimeInMillis());
        DateTime advanceTo = new DateTime(cAdvanceTo.getTimeInMillis());

        try {
            DateTimeIterator it = com.google.ical.compat.jodatime.DateTimeIteratorFactory.createDateTimeIterator(iCal, start, DateTimeZone.forID("Europe/Paris"), true);
            if (it != null){
                // On avance l'iterateur jusqua la date de debut de liste
                it.advanceTo(advanceTo);
                Date date;
                int i = 0;
                while(i<=5 && it.hasNext()) {
                    date=it.next().toDate();
                    System.out.println("date: "+date);
                    i++;
                }
            }
        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }


What is the expected output? What do you see instead?

I want to get the first Saturday of September, every two year. 
I want the list begin after : 2013-10-01T00:00:00.000.

Expected : 
date: Sat Sep 05 08:00:20 CEST 2015
date: Sat Sep 02 08:00:20 CEST 2017
date: Sat Sep 07 08:00:20 CEST 2019
date: Sat Sep 04 08:00:20 CEST 2021
date: Sat Sep 02 08:00:20 CEST 2023

See instead : 
date: Sat Sep 02 08:00:20 CEST 2017
date: Sat Sep 07 08:00:20 CEST 2019
date: Sat Sep 04 08:00:20 CEST 2021
date: Sat Sep 02 08:00:20 CEST 2023
date: Sat Sep 06 08:00:20 CEST 2025

The 2015 occurrence is ommited.

What version of the product are you using?
rfc2445-4Mar2011.jar 

Please provide any additional information below.
The problem does not occurs if I set : 
   sDateAdvanceTo="2013-09-30T00:00:00.000";


Original issue reported on code.google.com by [email protected] on 26 Sep 2014 at 7:37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant