Jet\DataListing_Filter_DateInterval

Already predefined filter for defining date and time interval. Just implement WHERE generation.

Example:

use Jet\DataListing_Filter_DateInterval;

class 
Listing_Filter_Date extends DataListing_Filter_DateInterval {
    
    public const 
KEY 'date';
    
    
    public function 
getKey(): string
    
{
        return static::
KEY;
    }
    
    public function 
generateWhere(): void
    
{
        if( 
$this->date_time_from ) {
            
$this->listing->addFilterWhere( [
                
'date >=' => $this->date_from,
            ] );
        }
        
        if( 
$this->date_time_till ) {
            
$this->listing->addFilterWhere( [
                
'date <=' => $this->date_till,
            ] );
        }
    }    
}
Previous chapter
Jet\DataListing_Filter_Search
Next chapter
Jet\DataListing_Filter_DateTimeInterval