rodrigopaco1986 / simple-daterange-picker

Simple date range picker filter for laravel nova 4
GNU General Public License v3.0
3 stars 11 forks source link

How to filter on 2 date fields of a table ? #8

Closed sergeynilov closed 1 week ago

sergeynilov commented 2 weeks ago

Thanks for your work and this usefull plugin!

I implemented this pluging("rpj/daterangepicker": "^0.0.8") in Laravel 10 / nova 4.27 app for products.published_at field and wonder if there is a way to filter on 2 date fields of a table :

CREATE TABLE `discounts` (
  `id` tinyint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  ...
  `active_from` date DEFAULT NULL,
  `active_till` date DEFAULT NULL,

?

rodrigopaco1986 commented 2 weeks ago

hello @LTKort It's not implemented yet. I'll add it soon in the next release (y)

stefvanesch commented 2 weeks ago

@sergeynilov what is the final query you expect here? Why not just register two separate filters?

sergeynilov commented 1 week ago

@stefvanesch with 4 datepickers on the form ? Do you mean this ?

rodrigopaco1986 commented 1 week ago

@stefvanesch please update to 0.0.9 version, you should be able to pass an array with two fields to filter, but you can still pass a single string as default:

(new \Rpj\Daterangepicker\Daterangepicker(['active_from', 'active_till']),