fix: properly filter by date range, improve filter handlers

This commit is contained in:
Björn Fromme
2025-03-21 12:38:55 +01:00
parent 06c32fd597
commit f2b60570a9
11 changed files with 98 additions and 66 deletions
+19
View File
@@ -6,8 +6,27 @@ use Carbon\CarbonPeriod;
class TimelineFilterDto extends AssignmentFilterDto
{
protected bool $includePast = true;
protected ?CarbonPeriod $_period = null;
public function getDateFrom(): ?\DateTimeImmutable
{
if (null === $this->dateFrom) {
return $this->_period->first()->toDateTimeImmutable();
}
return $this->dateFrom;
}
public function getDateTo(): ?\DateTimeImmutable
{
if (null === $this->dateTo) {
return $this->_period->last()->toDateTimeImmutable();
}
return $this->dateTo;
}
public function getPeriod(): ?CarbonPeriod
{
return $this->_period;