Files
solidtime/app/Service/TimezoneService.php
2024-03-19 19:11:36 +01:00

36 lines
603 B
PHP

<?php
declare(strict_types=1);
namespace App\Service;
use Carbon\CarbonTimeZone;
use DateTimeZone;
class TimezoneService
{
/**
* @return array<string>
*/
public function getTimezones(): array
{
$tzlist = CarbonTimeZone::listIdentifiers(DateTimeZone::ALL);
return $tzlist;
}
/**
* @return array<string, string>
*/
public function getSelectOptions(): array
{
$tzlist = $this->getTimezones();
$options = [];
foreach ($tzlist as $tz) {
$options[$tz] = $tz;
}
return $options;
}
}