<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSDateComponents/isValidDate(in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSDateComponents(im)isValidDateInCalendar:"
  },
  "title" : "isValidDate(in:)"
}
-->

# isValidDate(in:)

Returns a Boolean value that indicates whether the current combination of properties represents a date which exists in the specified calendar.

```
func isValidDate(in calendar: Calendar) -> Bool
```

## Parameters

`calendar`

The calendar for which to use in the calculation.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the date corresponding to the receiver’s values is valid and exists in the given calendar, otherwise <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

If the [`timeZone`](/documentation/Foundation/NSDateComponents/timeZone) property is set on the receiver, the time zone property value is used.

This property should not be used for [`NSDateComponents`](/documentation/Foundation/NSDateComponents) objects that represent relative quantities of calendar components. To find the the next or previous date that matches a particular set of date components, use the [`NSCalendar`](/documentation/Foundation/NSCalendar) instance method [`nextDate(after:matching:value:options:)`](/documentation/Foundation/NSCalendar/nextDate(after:matching:value:options:)) instead.

---

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)