We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Versions
Describe the bug Clicking the cancel button currently performs the functionality of the clear button.
To Reproduce Steps to reproduce the behavior:
<ngx-daterangepicker-material [ngClass]="isDatePickerVisible ? 'd-block' : 'd-none'" [opens]="'right'" [showDropdowns]="false" [showCustomRangeLabel]="true" [ranges]="dateRanges" [linkedCalendars]="false" [closeOnAutoApply]="true" [alwaysShowCalendars]="false" [keepCalendarOpeningWithRange]="false" [showRangeLabelOnInput]="true" [showCancel]="true" (rangeClicked)="rangeClicked($event)" (datesUpdated)="choosedDate($event)" (applyDateClick)="applyDateClick()" (cancelClicked)="cancelDateClick($event)" #dateRangePicker> </ngx-daterangepicker-material>
Below is TS code:
`Ts :
start_date: any; end_date: any; selected_range: string = '';
tempStartDate!: string; tempEndDate!: string; selected: { start: Dayjs; end: Dayjs; } | undefined; dateRanges: any = { 'Today': [moment(), moment()], 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')], 'Last 7 Days': [moment().subtract(6, 'days'), moment()], 'Last 30 Days': [moment().subtract(29, 'days'), moment()], 'This Month': [moment().startOf('month'), moment().endOf('month')], 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')] }; dateRangeControl = new FormControl([this.dateRanges['Last 7 Days'][0], this.dateRanges['Last 7 Days'][1]]); choosedDate(value: any) { this.start_date = value.startDate.format('YYYY-MM-DD'); this.end_date = value.endDate.format('YYYY-MM-DD'); this.selected_range = this.start_date + " to " + this.end_date;
this.getAllUsers(this.currentPage, this.itemsPerPage); this.toggleDatePicker(); }
toggleDatePicker(): void { this.isDatePickerVisible = !this.isDatePickerVisible; }
rangeClicked(range: any): void { this.start_date = range.dates[0].format('YYYY-MM-DD'); this.end_date = range.dates[1].format('YYYY-MM-DD'); this.selected_range = this.start_date + " to " + this.end_date; this.getAllUsers(this.currentPage, this.itemsPerPage); }
datesUpdated(range: any): void { this.start_date = range.dates[0].format('YYYY-MM-DD'); this.end_date = range.dates[1].format('YYYY-MM-DD'); this.selected_range = this.start_date + " to " + this.end_date; this.getAllUsers(this.currentPage, this.itemsPerPage); this.toggleDatePicker(); }
applyDateClick(): void { this.start_date = this.tempStartDate; this.end_date = this.tempEndDate; this.selected_range = ${this.start_date} to ${this.end_date}; this.getAllUsers(this.currentPage, this.itemsPerPage); this.toggleDatePicker(); }
${this.start_date} to ${this.end_date}
cancelDateClick(range: any): void { this.isDatePickerVisible = false; }`
Expected behavior Cancle should only close calender, do not clear selection.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Versions
Describe the bug
Clicking the cancel button currently performs the functionality of the clear button.
To Reproduce
Steps to reproduce the behavior:
<ngx-daterangepicker-material [ngClass]="isDatePickerVisible ? 'd-block' : 'd-none'" [opens]="'right'" [showDropdowns]="false" [showCustomRangeLabel]="true" [ranges]="dateRanges" [linkedCalendars]="false" [closeOnAutoApply]="true" [alwaysShowCalendars]="false" [keepCalendarOpeningWithRange]="false" [showRangeLabelOnInput]="true" [showCancel]="true" (rangeClicked)="rangeClicked($event)" (datesUpdated)="choosedDate($event)" (applyDateClick)="applyDateClick()" (cancelClicked)="cancelDateClick($event)" #dateRangePicker> </ngx-daterangepicker-material>
Below is TS code:
`Ts :
start_date: any;
end_date: any;
selected_range: string = '';
tempStartDate!: string;
tempEndDate!: string;
selected: { start: Dayjs; end: Dayjs; } | undefined;
dateRanges: any = {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
};
dateRangeControl = new FormControl([this.dateRanges['Last 7 Days'][0], this.dateRanges['Last 7 Days'][1]]);
choosedDate(value: any) {
this.start_date = value.startDate.format('YYYY-MM-DD');
this.end_date = value.endDate.format('YYYY-MM-DD');
this.selected_range = this.start_date + " to " + this.end_date;
this.getAllUsers(this.currentPage, this.itemsPerPage);
this.toggleDatePicker();
}
toggleDatePicker(): void {
this.isDatePickerVisible = !this.isDatePickerVisible;
}
rangeClicked(range: any): void {
this.start_date = range.dates[0].format('YYYY-MM-DD');
this.end_date = range.dates[1].format('YYYY-MM-DD');
this.selected_range = this.start_date + " to " + this.end_date;
this.getAllUsers(this.currentPage, this.itemsPerPage);
}
datesUpdated(range: any): void {
this.start_date = range.dates[0].format('YYYY-MM-DD');
this.end_date = range.dates[1].format('YYYY-MM-DD');
this.selected_range = this.start_date + " to " + this.end_date;
this.getAllUsers(this.currentPage, this.itemsPerPage);
this.toggleDatePicker();
}
applyDateClick(): void {
this.start_date = this.tempStartDate;
this.end_date = this.tempEndDate;
this.selected_range =
${this.start_date} to ${this.end_date}
;this.getAllUsers(this.currentPage, this.itemsPerPage);
this.toggleDatePicker();
}
cancelDateClick(range: any): void {
this.isDatePickerVisible = false;
}`
Expected behavior
Cancle should only close calender, do not clear selection.
The text was updated successfully, but these errors were encountered: