-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Not familiar with creating PR's. I wanted the ability to supply more than one country to get timezones from, so I implemented this customization. Could it possibly get added to master?
trait HasTimezoneOptions
protected array | string | Closure | null $byCountry = null;
public function byCountry(array | Closure | null $countryCodes): static
{
$this->byCountry = $countryCodes;
return $this;
}
protected function listTimezonesByCountry(array | string $countryCodes)
{
if (is_string($countryCodes)) {
$countryCodes = [$countryCodes];
}
$timezones = [];
foreach ($countryCodes as $countryCode) {
$timezones = array_merge($timezones, DateTimeZone::listIdentifiers(
timezoneGroup: DateTimeZone::PER_COUNTRY,
countryCode: $countryCode,
));
}
return $timezones;
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels