Fixes for date ranges

This commit is contained in:
David Bomba 2025-10-07 18:28:40 +11:00
parent 557700307c
commit 318e301308
1 changed files with 2 additions and 0 deletions

View File

@ -1291,10 +1291,12 @@ $products = str_getcsv($this->input['product_key'], ',', "'");
$this->end_date = 'All available data';
return $query;
case 'last7':
case 'last_7_days':
$this->start_date = now()->subDays(7)->format('Y-m-d');
$this->end_date = now()->format('Y-m-d');
return $query->whereBetween($this->date_key, [now()->subDays(7), now()])->orderBy($this->date_key, 'ASC');
case 'last30':
case 'last_30_days':
$this->start_date = now()->subDays(30)->format('Y-m-d');
$this->end_date = now()->format('Y-m-d');
return $query->whereBetween($this->date_key, [now()->subDays(30), now()])->orderBy($this->date_key, 'ASC');