---
title: allowedUnits
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/datecomponentsformatter/allowedunits
---

# allowedUnits

The bitmask of calendrical units such as day and month to include in the output string.

## Declaration

```swift
var allowedUnits: NSCalendar.Unit { get set }
```

## Discussion

Discussion The allowed calendar units are: year month weekOfMonth day hour minute second Assigning any other calendar units to this property results in an exception.

## See Also

### Configuring the Formatter Options

- [allowsFractionalUnits](foundation/datecomponentsformatter/allowsfractionalunits.md)
- [calendar](foundation/datecomponentsformatter/calendar.md)
- [collapsesLargestUnit](foundation/datecomponentsformatter/collapseslargestunit.md)
- [includesApproximationPhrase](foundation/datecomponentsformatter/includesapproximationphrase.md)
- [includesTimeRemainingPhrase](foundation/datecomponentsformatter/includestimeremainingphrase.md)
- [maximumUnitCount](foundation/datecomponentsformatter/maximumunitcount.md)
- [unitsStyle](foundation/datecomponentsformatter/unitsstyle-swift.property.md)
- [zeroFormattingBehavior](foundation/datecomponentsformatter/zeroformattingbehavior-swift.property.md)
