I have the following code for implementing a date range filter in the PrimeNG table.
<th class="filter_header">
<p-calendar
(onSelect)="historyTable.filter($event,'release_datetime', 'dateRangeFilter')"
placeholder="Search by release date"
[appendTo]="historyTable"
[(ngModel)]="rangeDates"
</p-calendar>
</th>
and in the component, I have FilterUtils
defined as follows:
FilterUtils['dateRangeFilter'] = (value, filter): boolean => {
if (filter === undefined || filter === null) {
return true;
}
if (value === undefined || value === null) {
return false;
}
console.log(value);
if (this.rangeDates[0] <= value && this.rangeDates[1] >= value) {
return true;
}
}
But this is not working. If anyone can guide me right direction, that would be helpful.
I am getting the value
as undefined. I have tried with $event.target.value
, but it is also not working.