<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/DateComponentsFormatter/allowedUnits",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSDateComponentsFormatter(py)allowedUnits"
  },
  "title" : "allowedUnits"
}
-->

# allowedUnits

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

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

## Discussion

The allowed calendar units are:

- [`year`](/documentation/Foundation/NSCalendar/Unit/year)
- [`month`](/documentation/Foundation/NSCalendar/Unit/month)
- [`weekOfMonth`](/documentation/Foundation/NSCalendar/Unit/weekOfMonth)
- [`day`](/documentation/Foundation/NSCalendar/Unit/day)
- [`hour`](/documentation/Foundation/NSCalendar/Unit/hour)
- [`minute`](/documentation/Foundation/NSCalendar/Unit/minute)
- [`second`](/documentation/Foundation/NSCalendar/Unit/second)

Assigning any other calendar units to this property results in an exception.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)