How to select only year on mat-datepicker

walidtlili

Hello i'm developing an application with angular 8 in wich i have an input that contains only year number. I have used mat-datepicker and want only to choose year.

<mat-form-field class="input-control">
      <input matInput placeholder="{{'enter'|translate}}.." [formControl]="form.controls.openedAt"
             [matDatepicker]="date" readonly>
      <mat-datepicker-toggle matSuffix [for]="date"></mat-datepicker-toggle>
      <mat-datepicker #date startView="multi-year"></mat-datepicker>
    </mat-form-field>

this code shows year view first, but when i choose the year, the month view will be opened, then days view.

So how can i select only year, or show only year view on mat-datepicker?

Tushar

This feature is not fully implemented yet. You can see that here:

https://github.com/angular/components/issues/4853

For now you can try this:

https://stackblitz.com/edit/angular-mulitdate-picker-demo

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

how to show only current year in mat-datepicker

How to select the year FIRST in DatePicker

How to get only year from kendo datepicker?

How to make ngx-bootstrap datepicker be able to select and display only month and year?

How to hide year toggle from header in mat-datepicker

Datepicker - Year Only

Jquery datepicker, select year

How to select only Month/Year with the InputDate control

How to only select month and year in a shiny widget

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

How to accept only Month and Year using DatePicker in iOS

How to limit DatePicker to display only current year in React JS?

Meteor datepicker month and year only

Silverlight DatePicker YearMonth and Year only

Only select date in datePicker

jQuery UI DatePicker to show month year only

Update bootstrap datepicker value in year only mode

Setting the Datepicker in IOS to pick only the Month and Year

Angular Material 2 DatePicker with only month and year

Datepicker automatically hide on month or year select

How to convert jQuery date picker to select only month and year?

How to get only year from age() function in postgresql select query

How to select only the individuals that appear in every year of a dataframe in r

How to Select & Show Only Year from date (MySQL) in PHP

How to set show some string in mat-datepicker input but in backend it is only the date that is sending

SQLite - select row by year only?

jQuery DatePicker select only saturday

rails date_select, select year only

How to clear mat-datepicker in Angular 5