# Show Opacity for Disabled Months in DatePicker

## Environment

<table>
    <tbody>
        <tr>
            <td>Product</td>
            <td>Progress® Kendo UI for Angular DatePicker</td>
        </tr>
    </tbody>
</table>

## Description

How to show an opacity for a disabled month in a DatePicker's Year View?

## Solution

1. Use the built-in [`disabledDates`](https://www.telerik.com/kendo-angular-ui/components/dateinputs/api/datepickercomponent#disableddates) callback of the `DatePicker` component and disable the desired month in the handler.

   ```html
   <kendo-datepicker
       ...
       [disabledDates]="isDateDisabled"
   >...</kendo-datepicker>
   ```

   ```ts
   public isDateDisabled(date: Date): boolean {
       return date.getMonth() === 5;
   }
   ```

2. Inside the DatePicker component, use the built-in [`YearCellTemplateDirective`](https://www.telerik.com/kendo-angular-ui/components/dateinputs/api/yearcelltemplatedirective). Inside the template, apply the `k-disabled` class to the disabled month in order to change the opacity.

   ```html
   <ng-template kendoCalendarYearCellTemplate let-context="cellContext">
       <span [class.k-disabled]="isDateDisabled(context.value)">
           {{context.formattedValue}}
       </span>
   </ng-template>
   ```

The following example shows the full implementation of the described approach.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/knowledge-base/disable-month-view/source.txt)
