random improvements (#5382)

* remove permission check, as own timesheets should always be visible
* new methods to create datetime
* allow access to user roles in javascript
* support class for dropdown actions
* allow to edit internal rate
* support human readable duration in export via user configuration
* allow to order timesheet listing by user, exported and billable field
* bump codecov action
This commit is contained in:
Kevin Papst
2025-03-13 18:00:50 +01:00
committed by GitHub
parent 934fdeb107
commit 2a75cd6230
26 changed files with 271 additions and 36 deletions

View File

@@ -69,6 +69,19 @@ final class DateTimeFactory
return DateTime::createFromInterface($date);
}
private function createDate(DateTimeInterface|string|null $date = null): \DateTimeImmutable
{
if ($date === null) {
$date = 'now';
}
if (\is_string($date)) {
return $this->create($date);
}
return \DateTimeImmutable::createFromInterface($date);
}
public function getStartOfWeek(DateTimeInterface|string|null $date = null): DateTime
{
$date = $this->getDate($date);
@@ -139,6 +152,20 @@ final class DateTimeFactory
return new \DateTimeImmutable($datetime, $this->getTimezone());
}
public function createStartOfDay(DateTimeInterface|string|null $date = null): \DateTimeImmutable
{
$date = $this->createDate($date);
return $date->modify('00:00:00');
}
public function createEndOfDay(DateTimeInterface|string|null $date = null): \DateTimeImmutable
{
$date = $this->createDate($date);
return $date->modify('23:59:59');
}
/**
* @param string $format
* @param null|string $datetime