-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
5.0
-
x86
-
windows_xp
A DESCRIPTION OF THE REQUEST :
java.util.Calendar lets you set the WEEK_OF_MONTH, and the DAY_OF_WEEK_IN_MONTH. Together with the DAY_OF_WEEK field this means you can uniquely specify a weekday.
Unfortunately, a given Tuesday, say, is relative to either (a) the week of the month as determined by the getMinimalDaysInFirstWeek()/getFirstDayOfWeek() method pair, or (b) nothing really (that's what DAY_OF_WEEK_IN_MONTH is for).
So there is no way to say "the first Tuesday in November" in one shot, which is the most common use case.
JUSTIFICATION :
This is the most common use case for calendaring applications ("takes place on the second Tuesday of the month", which of course is not DAY_OF_WEEK_IN_MONTH == 2 && DAY_OF_WEEK == TUESDAY, nor is it WEEK_OF_MONTH == 2 && DAY_OF_WEEK == TUESDAY).
The edge cases illustrate this. The first Tuesday of November, 1996 is November 5, but java.util.Calendar will return October (!) 29 if you use any combination of DAY_OF_WEEK_IN_MONTH, WEEK_OF_MONTH, or DAY_OF_WEEK.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I would like to see a field added to java.util.Calendar that picks out the first weekday specified that is also after DAY_OF_MONTH == 1.
java.util.Calendar lets you set the WEEK_OF_MONTH, and the DAY_OF_WEEK_IN_MONTH. Together with the DAY_OF_WEEK field this means you can uniquely specify a weekday.
Unfortunately, a given Tuesday, say, is relative to either (a) the week of the month as determined by the getMinimalDaysInFirstWeek()/getFirstDayOfWeek() method pair, or (b) nothing really (that's what DAY_OF_WEEK_IN_MONTH is for).
So there is no way to say "the first Tuesday in November" in one shot, which is the most common use case.
JUSTIFICATION :
This is the most common use case for calendaring applications ("takes place on the second Tuesday of the month", which of course is not DAY_OF_WEEK_IN_MONTH == 2 && DAY_OF_WEEK == TUESDAY, nor is it WEEK_OF_MONTH == 2 && DAY_OF_WEEK == TUESDAY).
The edge cases illustrate this. The first Tuesday of November, 1996 is November 5, but java.util.Calendar will return October (!) 29 if you use any combination of DAY_OF_WEEK_IN_MONTH, WEEK_OF_MONTH, or DAY_OF_WEEK.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I would like to see a field added to java.util.Calendar that picks out the first weekday specified that is also after DAY_OF_MONTH == 1.
- relates to
-
JDK-6452848 (cal) Conflict resolution doesn't work as specified in Calendar API doc
-
- Closed
-