components icon indicating copy to clipboard operation
components copied to clipboard

Change the year range in a multi-year view in mat-datepicker

Open boboantic opened this issue 5 years ago • 5 comments

Feature Description

The possibility to control the year range in a multi-year view in the mat-datepicker in Angular Material 7.

What is the current behavior?

Currently the default range of 24 years starts from 2016-2039, and each page backwards offers another 24-year range.

Use Case

I need to show a different year range in the multi-year view in the mat-datepicker. I need the possibility to manipulate the year range to be different than the default (which is 2016-2039 in the starting view), e.g. 2010-2033. This will improve the UX of an application where customers mostly select years beginning from 2010 (customers now need to go to the previous page with a year range from 1992-2015.

boboantic avatar Jan 20 '20 15:01 boboantic

Any workaround for this?

gauravbora2008 avatar Feb 02 '20 07:02 gauravbora2008

Any Updates? Any solutions how I can change total amount of cells or amount of cells in a row on 'year'/'month' views? Now I have to use horrible hack

  dateClass: MatCalendarCellClassFunction<Date> = (cellDate, view) => {
    if (view === 'year') {
      return `year-cell-${cellDate.getMonth()}`;
    }

    return '';
  };

And than apply absolute positions to classes... and here I just want to change the month view to image

fomenkogregory avatar Mar 04 '21 20:03 fomenkogregory

Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

Find more details about Angular's feature request process in our documentation.

angular-robot[bot] avatar Feb 22 '22 15:02 angular-robot[bot]

Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.

We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

You can find more details about the feature request process in our documentation.

angular-robot[bot] avatar Mar 14 '22 15:03 angular-robot[bot]

Any workaround for this?

leosauberman avatar Jul 27 '22 12:07 leosauberman