Share

Recur

Tracker: Bugs

5 BYDAY, BYMONTH - ID: 690474
Last Update: Comment added ( nobody )

I think I've found a bug. I set the following Recurrance object:

Recurrance("FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=5",5/12/2002
)

Then I called the following:

getAllMatchingDatesOverRange(1/1/2003,12/31/2003)

I get the following returned: 1/12/2003

It should be 5/11/2003. (Mother's Day in the United States.)

I've found this on several other repeating events when there is a
"BYDAY" and a "BYMONTH".

I'll see if I can take a look at the code more closely in the next few
days. I'm good at creating various interfaces, but I'm not sure if I can
follow the logic once I start looking at the code, but I'll give it a shot.
If you have time, that would be great.

I want you to know that I really appreciate your help with this and your
original work on this project.

Thanks!
iowaboy


Derek Haidle ( iowaboy ) - 2003-02-21 03:39

5

Open

None

Nobody/Anonymous

None

None

Public


Comments ( 2 )




Date: 2003-10-21 17:07
Sender: nobody

Logged In: NO

I think I've found the "bug" (I'm not sure it is a bug,
but...).

Inside huntDayOfWeek(Calendar curProtoDate, ByDay bd), the
function tries to find out the kind of "frequency" only looking

at the "freq" variable

// figure out if we're talking months or years.
int unit = Calendar.DAY_OF_MONTH;
if ( "YEARLY".equals(freq) ){
unit = Calendar.DAY_OF_YEAR;
}

It's ok to the RFC, *but* it doesn't take care about
the "BYMONTH" rules, so we have an error.

To correct the situation (almost with BYMONTH rules) try
replacing the "if()" above with:

if ( "YEARLY".equals(freq) && !foundByMonth ){
unit = Calendar.DAY_OF_YEAR;
}

I don't know if there are others BYXXX rules affecting this
behaviour.

Thanks for such a great work (to the programmer)


Date: 2003-09-15 12:30
Sender: slite2

Logged In: YES
user_id=396953

I found the same thing. In my case, I tried to get the last
Friday in August. Instead, I got the last Friday in December.

I got it working by replacing "BYDAY=-1FR"
with "BYDAY=FR;BYSETPOS=-1".


Log in to comment.

Attached File

No Files Currently Attached

Change

No changes have been made to this artifact.