CFCalendar: swap the minimum and maximum unit ranges - #134
Open
DTW-Thalion wants to merge 1 commit into
Open
Conversation
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
force-pushed
the
fix/cfcalendar-minmax-range
branch
from
July 24, 2026 15:22
ce58b3e to
d29a570
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.