2024-12-13 02:46:44 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Contribution\Traits;
|
|
|
|
|
|
|
|
use Carbon\Carbon;
|
|
|
|
|
|
|
|
trait FormatsDates
|
|
|
|
{
|
|
|
|
|
|
|
|
public function niceDateFrom(): string
|
|
|
|
{
|
|
|
|
return Carbon::parse($this->dateFrom)->format('d.m.Y');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function niceDateUntil(): string
|
|
|
|
{
|
|
|
|
return Carbon::parse($this->dateUntil)->format('d.m.Y');
|
|
|
|
}
|
2024-12-13 14:37:13 +01:00
|
|
|
|
|
|
|
public function dateRange(): string
|
|
|
|
{
|
|
|
|
return implode(' - ', [$this->niceDateFrom(), $this->niceDateUntil()]);
|
|
|
|
}
|
2024-12-13 02:46:44 +01:00
|
|
|
}
|