I am using Formly with Material in Angular and have a datepicker. All I want to do is disable future dates so they cannot be selected when selecting a date, I can't seem to find anything online!
export class AppComponent {
form = new FormGroup({});
model: any = {};
options: FormlyFormOptions = {};
fields: FormlyFieldConfig[] = [
{
key: 'Datepicker',
type: 'datepicker',
templateOptions: {
label: 'Datepicker',
placeholder: 'Placeholder',
description: 'Description',
required: true,
//what to put here to disable future dates?
},
},
];
}
You can play around with the code here: https://stackblitz.com/angular/gkyxqxygybo?file=src%2Fapp%2Fapp.component.ts
maxDate
but when I adddate = new Date();
above where form is declared and thenmaxDate
: this.date, it doesn't do anything – Juan Pablo Feb 12 '20 at 23:55