Adds addRangeFrom() method.
This commit is contained in:
parent
826831b36c
commit
71bca9f1b1
4 changed files with 52 additions and 7 deletions
|
|
@ -57,7 +57,7 @@ trait Basics {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function addRange( DateTime $start, ?DateTime $stop = null ): QueryBuilderInterface {
|
||||
public function addRange( mixed $start, ?DateTime $stop = null ): QueryBuilderInterface {
|
||||
$this->setRequirements();
|
||||
|
||||
$this->addToQuery(
|
||||
|
|
@ -73,6 +73,12 @@ trait Basics {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function addRangeFrom( string $from ): QueryBuilderInterface {
|
||||
$this->addRange( $from );
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addRangeInBetween( DateTime $start, DateTime $stop ): QueryBuilderInterface {
|
||||
$this->addRange( $start, $stop );
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class Range extends Base {
|
|||
*/
|
||||
private $stop;
|
||||
|
||||
public function __construct( DateTime $start, ?DateTime $stop = null ) {
|
||||
public function __construct( mixed $start, ?DateTime $stop = null ) {
|
||||
$this->start = new Type( $start );
|
||||
$this->stop = $stop ? new Type( $stop ) : null;
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ class Range extends Base {
|
|||
throw new FunctionRequiredSettingMissingException( 'Range', 'Start setting is required!' );
|
||||
}
|
||||
|
||||
$settingsString = 'start: ' . $this->start;
|
||||
$settingsString = str_replace( '"', '', 'start: ' . $this->start );
|
||||
if ( $this->stop ) {
|
||||
$settingsString .= ', stop: ' . $this->stop;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
editor.link_modal.header
Reference in a new issue