Set max date on picker

This commit is contained in:
2019-10-02 19:58:03 -04:00
parent d3804cd5d6
commit 6101cf6a76
2 changed files with 2 additions and 1 deletions

View File

@@ -13,7 +13,7 @@
<mat-icon>arrow_back</mat-icon>
</button>
<mat-form-field *ngIf="selectedTimeSpan === timeSpans.Day">
<input matInput [matDatepicker]="picker" [(ngModel)]="selectedDate" disabled>
<input matInput [matDatepicker]="picker" [(ngModel)]="selectedDate" disabled [max]="maxDate">
<mat-datepicker-toggle matSuffix [for]="picker">
<mat-icon matDatepickerToggleIcon>keyboard_arrow_down</mat-icon>
</mat-datepicker-toggle>

View File

@@ -29,6 +29,7 @@ export class WeatherChartsComponent implements OnInit {
public timeSpanItems: { [value: number]: string } = {};
public timeSpans: typeof TimeSpan = TimeSpan;
public maxDate: moment.Moment = moment().endOf('day');
private selectedTimeSpanValue: TimeSpan = TimeSpan.Last24Hours;
private selectedDateValue: moment.Moment = moment().startOf('day');