Answers for "how to give label for mat date picker"

0

date time picker in angular material

<input mdc-datetime-picker="" date="true" time="true" type="text" id="datetime"
placeholder="Date" show-todays-date="" minutes="true" min-date="date" show-icon="true"
ng-model="dateTime" class=" dtp-no-msclear dtp-input md-input">
Posted by: Guest on January-03-2021
0

show date range on mat-calendar

providers: [
    {
      provide: MAT_DATE_RANGE_SELECTION_STRATEGY,
      useClass: DefaultMatCalendarRangeStrategy,
    },
  ],
  
  // Then, you'd have to do some converting of Date to DateRange.
  
  selectedDateRange: DateRange<Date>;

  _onSelectedChange(date: Date): void {
    if (
      this.selectedDateRange &&
      this.selectedDateRange.start &&
      date > this.selectedDateRange.start &&
      !this.selectedDateRange.end
    ) {
      this.selectedDateRange = new DateRange(
        this.selectedDateRange.start,
        date
      );
    } else {
      this.selectedDateRange = new DateRange(date, null);
    }
  }
  
  
  <mat-calendar (selectedChange)="_onSelectedChange($event)"
                [selected]="selectedDateRange">
  </mat-calendar>
Posted by: Guest on January-18-2022

Browse Popular Code Answers by Language