---
title: "range(of:in:for:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/calendar/range(of:in:for:)"
---

# range(of:in:for:)

Returns the range of absolute time values that a smaller calendar component (such as a day) can take on in a larger calendar component (such as a month) that includes a specified absolute time.

## Declaration

```swift
func range(of smaller: Calendar.Component, in larger: Calendar.Component, for date: Date) -> Range<Int>?
```

## Parameters

- `smaller`: The smaller calendar component.
- `larger`: The larger calendar component.
- `date`: The absolute time for which the calculation is performed.

## Return Value

Return Value The range of absolute time values smaller can take on in larger at the time specified by date. Returns nil if larger is not logically bigger than smaller in the calendar, or the given combination of components does not make sense (or is a computation which is undefined).

## Discussion

Discussion You can use this method to calculate, for example, the range the day component can take on in the month in which date lies.

## See Also

### Getting Calendar Information

- [identifier](foundation/calendar/identifier-swift.property.md)
- [locale](foundation/calendar/locale.md)
- [firstWeekday](foundation/calendar/firstweekday.md)
- [minimumDaysInFirstWeek](foundation/calendar/minimumdaysinfirstweek.md)
- [timeZone](foundation/calendar/timezone.md)
- [maximumRange(of:)](foundation/calendar/maximumrange(of:).md)
- [minimumRange(of:)](foundation/calendar/minimumrange(of:).md)
- [ordinality(of:in:for:)](foundation/calendar/ordinality(of:in:for:).md)
