Add DateTime required param for Range functions
Signed-off-by: davidarendsen <davidarendsen@hey.com>
This commit is contained in:
parent
15a3f8fcde
commit
95e71624d5
5 changed files with 33 additions and 51 deletions
|
|
@ -18,10 +18,10 @@ class Range extends Base {
|
|||
*/
|
||||
private $stop;
|
||||
|
||||
public function __construct(array $settings)
|
||||
public function __construct(DateTime $start, ?DateTime $stop = null)
|
||||
{
|
||||
$this->start = isset($settings['start']) ? $settings['start'] : null;
|
||||
$this->stop = isset($settings['stop']) ? $settings['stop'] : null;
|
||||
$this->start = Formatters::dateTimeToString($start);
|
||||
$this->stop = $stop ? Formatters::dateTimeToString($stop) : null;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
|
|
@ -31,16 +31,6 @@ class Range extends Base {
|
|||
throw new FunctionRequiredSettingMissingException('Range', 'Start setting is required!');
|
||||
}
|
||||
|
||||
if($this->start instanceof DateTime)
|
||||
{
|
||||
$this->start = Formatters::dateTimeToString($this->start);
|
||||
}
|
||||
|
||||
if($this->stop instanceof DateTime)
|
||||
{
|
||||
$this->stop = Formatters::dateTimeToString($this->stop);
|
||||
}
|
||||
|
||||
$settingsString = 'start: ' . $this->start;
|
||||
if($this->stop)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
editor.link_modal.header
Reference in a new issue