# CalendarConstraints

[View Source](https://github.com/material-components/material-components-android/blob/1.14.0/lib/java/com/google/android/material/datepicker/CalendarConstraints.java)

*** ** * ** ***


```
public final class CalendarConstraints
```

<br />

*** ** * ** ***

Used to limit the display range of the calendar and set an openAt month.

Implements Parcelable in order to maintain the `CalendarConstraints` across device configuration changes. Parcelable breaks when passed between processes.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/com/google/android/material/datepicker/CalendarConstraints.Builder` Builder for `https://developer.android.com/reference/com/google/android/material/datepicker/CalendarConstraints`. |
| `public interface https://developer.android.com/reference/com/google/android/material/datepicker/CalendarConstraints.DateValidator` Used to determine whether calendar days are enabled. |

| ### Constants |
|---|---|
| `static final Creator<CalendarConstraints>` | `https://developer.android.com/reference/com/google/android/material/datepicker/CalendarConstraints#CREATOR()` Parcelable.Creator |

| ### Public methods |
|---|---|
| `int` | `https://developer.android.com/reference/com/google/android/material/datepicker/CalendarConstraints#describeContents()()` |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/datepicker/CalendarConstraints#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o)` |
| `https://developer.android.com/reference/com/google/android/material/datepicker/CalendarConstraints.DateValidator` | `https://developer.android.com/reference/com/google/android/material/datepicker/CalendarConstraints#getDateValidator()()` Returns the `https://developer.android.com/reference/com/google/android/material/datepicker/CalendarConstraints.DateValidator` that determines whether a date can be clicked and selected. |
| `long` | `https://developer.android.com/reference/com/google/android/material/datepicker/CalendarConstraints#getEndMs()()` Returns the latest time in milliseconds allowed by this set of bounds. |
| `https://developer.android.com/reference/java/lang/Long` | `https://developer.android.com/reference/com/google/android/material/datepicker/CalendarConstraints#getOpenAtMs()()` Returns the openAt time in milliseconds within this set of bounds. |
| `long` | `https://developer.android.com/reference/com/google/android/material/datepicker/CalendarConstraints#getStartMs()()` Returns the earliest time in milliseconds allowed by this set of bounds. |
| `int` | `https://developer.android.com/reference/com/google/android/material/datepicker/CalendarConstraints#hashCode()()` |
| `void` | `https://developer.android.com/reference/com/google/android/material/datepicker/CalendarConstraints#writeToParcel(Parcel,int)(Parcel dest, int flags)` |

## Constants

### CREATOR

```
public static final Creator<CalendarConstraints> CREATOR
```

Parcelable.Creator

## Public methods

### describeContents

```
public int describeContents()
```

### equals

```
public boolean equals(Object o)
```

### getDateValidator

```
public CalendarConstraints.DateValidator getDateValidator()
```

Returns the `https://developer.android.com/reference/com/google/android/material/datepicker/CalendarConstraints.DateValidator` that determines whether a date can be clicked and selected.

### getEndMs

```
public long getEndMs()
```

Returns the latest time in milliseconds allowed by this set of bounds.

### getOpenAtMs

```
public Long getOpenAtMs()
```

Returns the openAt time in milliseconds within this set of bounds. Returns null if not available.

### getStartMs

```
public long getStartMs()
```

Returns the earliest time in milliseconds allowed by this set of bounds.

### hashCode

```
public int hashCode()
```

### writeToParcel

```
public void writeToParcel(Parcel dest, int flags)
```