valor-software / ngx-bootstrap

Fast and reliable Bootstrap widgets in Angular (supports Ivy engine)
https://valor-software.com/ngx-bootstrap
MIT License
5.53k stars 1.69k forks source link

Reset Ngx Bootstrap Inline Date Range Picker #6401

Open rahulk0310 opened 2 years ago

rahulk0310 commented 2 years ago

I am trying to reset the inline date range picker selection on click of a button. As soon as I click on the reset button Value change event is not emitting.

<bs-daterangepicker-inline
    [minDate]="minDate"
    [bsValue]="bsInlineRangeValue"
        [bsConfig]="{
        showWeekNumbers: false,
        preventChangeToNextMonth: true
    }"
    (bsValueChange)="onValueChange($event)"
></bs-daterangepicker-inline>
<br>
<a style="display: block" (click)="reset()">Reset</a>
minDate = new Date();
maxDate = new Date();
bsInlineRangeValue!: Date[];

constructor() {
         this.maxDate.setDate(this.maxDate.getDate() + 7);
         this.bsInlineRangeValue = [new Date(), this.maxDate];
}

onValueChange(value: any): void {
    console.log(value);
        //Not firing after reset
}

reset() {
    this.bsInlineRangeValue = [];
}
rahulk0310 commented 2 years ago

Any update on this?