mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-06-15 13:32:43 +01:00
36 lines
603 B
PHP
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;
|
|
}
|
|
}
|