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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user