For material datepicker we can use propery max and min to set range of avaliable years. But, it still display some unavaliable years. Is there any way to remove those years ? Need to remove years from 98-09
How to remove disabled years from material datepicker?
395 Views Asked by Ruslan Slim At
1
There are 1 best solutions below
Related Questions in ANGULAR
- Firebase link existing user to anonymous account?
- It doesnt always show all the books on my homepage
- Google adsense ads.txt status cannot be not found
- When I navigate to the URL'http://localhost:4200/', it redirects me back
- Ionic Angular Standalone ion-icon are not showing at all
- How to make Angular understand that view child is of a specific type, not a general ElementRef?
- vscode, debug angular, first time, doesn't debug, 2nd time stops at main.js then it's ok
- How to perform CRUD operations on a static JSON array in Angular? (without API)
- Ngrx props<>() method in createAction()
- How to animate rotation of an image inside input control?
- Detecting click inside and outside of the listening component in Angular
- Angular - type guard not narrowing types
- In node_modules file i am getting Angular genric error while using fontawesome in angular12
- Angular 16 sending null values to API
- GoogleCloud Error: Not Found The requested URL was not found on this server
Related Questions in DATEPICKER
- Prime React calendar : range and multiple mode support for Month and year Picker
- Enable the user to pick a date from Calender for non consecutive date only in ios?
- MUI DatePicker 6.19.7 change picked day bgcolor using sx
- Datepicker UI resets on error after form submission
- How to clear existing date value from a table cell with datepicker?
- c# Radzen datepicker throw error after render
- How to get a datepicker like in the official Contacts app?
- Flowbite datepicker z-index issue in modal
- Custom Range label in ng2-datepicker
- android material date picker is very slow
- @mui/x-date-pickers DatePicker Format Problem
- How to prevent dropdown closing on selecting date from mat datepicker
- MUI DatePicker bugging on Thinkpad
- Content Controls on macOS with different locale / language
- Date-picker in v-menu is not showing up (Vuetify)
Related Questions in DATE-RANGE
- Simple Count of Rows that contain a date within a given Date Range
- How to split row with date range into multip rows by year
- SQL 2019 -Group by Id and Date field
- Angular primeng range datefor example from january 31 to dicember 1st 2023 in a reactive form and calculate if the year is a leap year or not
- DateRange from @appbaseio/reactivesearch does not allow me to select past dates
- attendance table log mysql
- Reset ant design RangeSelect value after it closes
- How to Ensure Default Date Range Filter Applies in Embedded Looker Studio Report?
- Unable to select the today's date in SfDateRangePicker calendar
- Splitting one row with date field into multiple rows with specified quarter dates
- Update Criteria for Yearly Date Range Without User Input
- Implementing a "Custom Comparison Date Range" in Looker Studio
- Date Range Filter is giving wrong Value
- Graphql date range as input field
- Select multiple date ranges for the same event using Full Calendar
Related Questions in MATERIALDATEPICKER
- android material date picker is very slow
- ASP.NET Core Web API receives one day back date posted by angular material datepicker
- Text Watcher for the MaterialDatePicker manual input
- Android how increase the font size of Month Selector of DatePickerDialog
- Turn the long generated by MaterialDatePicker into year, month, and day varialbes
- How do i set `setOnDateChangedListener` into `MaterialDatePicker` in android kotlin?
- Select Maximum 30 days in MaterialDatePicker Calender
- MaterialDatePicker - how to select max 3 months?
- Android com.google.android.material.datepicker.MaterialCalendar.getCurrentMonth()' on a null object reference
- The Date Picker Range dialog is opening two time how to make open single dialog and perform necessary operation according to my code
- Unable to customize DateRangePicker in Android compose
- Set MaterialDatePicker calender language to English only
- how to change the color of today which is pre selected date mat-datepicker Angular
- MaterialDatePicker How to Change m/d/yy to dd/mm/yyyy in android
- How to import css for Angular Material Datepicker?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Bit of a hack, but since this is all HTML what you can do is create a custom directive to remove those items from your HTML.
Create a directive:
What this does is taps into the private method of
datePickers's_viewChanged. If the view is of themulti-yeartype then we know we are looking at our selection of available years.Then what it does is using the
documentit will get all the elements whose class name implies they are disabled. From there it calls the renderer and tells it to remove those children from the parent component. In this case the parent component is the datepicker.In your HTML you will use this directive by applying it to the mat-datepicker itself like so:
Working stackblitz:
https://stackblitz.com/edit/angular-8dzujz?file=src/app/disabled-dates.directive.ts
Edit: Directives in Angular are a powerful tool to help you create all sorts of custom behaviors, and ways to extend your code or tap into the underlying HTML of a separate component for which you have no direct access to (ex: Mat Datepicker)
Edit 2:
The
.bind(this)is required becausethisin JS is a very odd and unfortunate creature. Without the binding, if you try to call elements which can be access usingthisinside of that method it will throw an undefined error because its version ofthisis different than thethisthat belongs to the directive itself. As such, binding it that way makes it so that any time we usethisinside of that method (mind you intellisense will not complain if you don't do this) is the actualthisof your directive.