---
title: "isValidDate(in:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsdatecomponents/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.

## Declaration

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

## Parameters

- `calendar`: The calendar for which to use in the calculation.

## Return Value

Return Value true if the date corresponding to the receiver’s values is valid and exists in the given calendar, otherwise false.

## Discussion

Discussion If the timeZone property is set on the receiver, the time zone property value is used. This property should not be used for 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 instance method nextDate(after:matching:value:options:) instead.

## See Also

### Validating a Date

- [isValidDate](foundation/nsdatecomponents/isvaliddate.md)
- [date](foundation/nsdatecomponents/date.md)
- [Undefined Components](foundation/1430344-undefined-components.md)
