Skip to content

CFCalendar: swap the minimum and maximum unit ranges - #134

Open
DTW-Thalion wants to merge 1 commit into
gnustep:masterfrom
DTW-Thalion:fix/cfcalendar-minmax-range
Open

CFCalendar: swap the minimum and maximum unit ranges#134
DTW-Thalion wants to merge 1 commit into
gnustep:masterfrom
DTW-Thalion:fix/cfcalendar-minmax-range

Conversation

@DTW-Thalion

Copy link
Copy Markdown
Contributor

CFCalendarGetMaximumRangeOfUnit and CFCalendarGetMinimumRangeOfUnit had their limits reversed. The maximum-range function used the greatest minimum and least maximum, giving the narrowest range a unit can take, while the minimum-range function used the field minimum and maximum, giving the widest. For the day of the month this meant the maximum range came back as 1 to 28 and the minimum as 1 to 31.

Swap them: the maximum range uses the field minimum and maximum, and the minimum range uses the greatest minimum and least maximum.

Tests/CFCalendar/ranges.m checks the day-of-month maximum (1 to 31) and minimum (1 to 28), verified against Apple CoreFoundation.

CFCalendarGetMaximumRangeOfUnit returned the narrowest range a unit can take
and CFCalendarGetMinimumRangeOfUnit the widest, the opposite of what the names
mean.  The maximum range now uses the field minimum and maximum and the
minimum range uses the greatest minimum and least maximum.
@DTW-Thalion
DTW-Thalion force-pushed the fix/cfcalendar-minmax-range branch from ce58b3e to d29a570 Compare July 24, 2026 15:22
@DTW-Thalion DTW-Thalion reopened this Jul 24, 2026
@DTW-Thalion DTW-Thalion reopened this Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant