ngxDaterangepickerMd in trigger event on selection of start/end date

Issue

I want to set dynamically min and max date in ngx-daterangepicker-material. Please help me to find out the event in ngxDaterangepickerMd.

Solution

I have found the answer.

startDateClicked($event) {
    this.maxDate = moment($event.startDate._d).add(1, 'month');
  }
  endDateClicked($event) {
    this.minDate = moment($event.endDate._d).subtract(1, 'month');
  }
 <input type="text" ngxDaterangepickerMd [(ngModel)]="selected" [showCustomRangeLabel]="true"
                  [ranges]="ranges" [showCancel]="true" [keepCalendarOpeningWithRange]="keepCalendarOpeningWithRange"
                  [showRangeLabelOnInput]="showRangeLabelOnInput" opens="right" [timePicker]="true"
                  [locale]="{format: 'MM/DD/YYYY'}" (datesUpdated)="applyFilter()" [minDate]="minDate"
                  [maxDate]='maxDate' (startDateChanged)="startDateClicked($event)"
                  (endDateChanged)="endDateClicked($event)"">

Answered By – surendra kumar

Answer Checked By – David Marino (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.