tracer
tracer

Reputation: 442

How to make a kendo-angular-datepicker to show year only

How to configure the kendo-angular date picker to show year only on selecting.

Upvotes: 2

Views: 3438

Answers (2)

Sixteen
Sixteen

Reputation: 563

To show year only and be able to select year only, this is what I use

<kendo-datepicker
    format="yyyy" <!-- Shows year only inside the textbox -->
    activeView="decade" <!-- Starting point inside the popup -->
    bottomView="decade" <!-- Can't navigate down in the popup -->
    topView="decade" <!-- Can't navigate up in the popup -->
    <!-- Add more option below as needed -->
></kendo-datepicker>

Copy-Pastable

<kendo-datepicker
    format="yyyy"
    activeView="decade"
    bottomView="decade"
    topView="decade"
></kendo-datepicker>

More info here : Kendo DatePickerComponent API doc

Upvotes: 2

tracer
tracer

Reputation: 442

I have tried and got the below solution, so thought of posting it if in case anyone needs:

<kendo-datepicker
      [min]="min"
      [max]="max"
      [bottomView]="'year'"
      [format]="'yyyy'"
      [(value)]="value"
  ></kendo-datepicker>

Upvotes: 2

Related Questions