fix timesheet collection fetch via API with end datetime set (#2552)

This commit is contained in:
Kevin Papst
2021-05-05 13:02:09 +02:00
committed by GitHub
parent 4fcd97b142
commit f10aad927f
3 changed files with 15 additions and 5 deletions

View File

@@ -13,9 +13,15 @@ use DateTime;
final class DateRange
{
private $resetTimes;
private $begin;
private $end;
public function __construct(bool $resetTimes = true)
{
$this->resetTimes = $resetTimes;
}
public function getBegin(): ?DateTime
{
return $this->begin;
@@ -24,7 +30,9 @@ final class DateRange
public function setBegin(DateTime $begin): DateRange
{
$this->begin = $begin;
$this->begin->setTime(0, 0, 0);
if ($this->resetTimes) {
$this->begin->setTime(0, 0, 0);
}
return $this;
}
@@ -37,7 +45,9 @@ final class DateRange
public function setEnd(DateTime $end): DateRange
{
$this->end = $end;
$this->end->setTime(23, 59, 59);
if ($this->resetTimes) {
$this->end->setTime(23, 59, 59);
}
return $this;
}