briannesbitt/Carbon · error · InvalidArgumentException

Timezone ID '{}' is invalid. It must be one of the IDs from

Error message

Timezone ID '{}' is invalid.
It must be one of the IDs from DateTimeZone::listIdentifiers(),
For the record, hours/minutes offset are relevant only for a particular moment, but not as a default timezone.

What it means

Error "Timezone ID '{}' is invalid. It must be one of the IDs from DateTimeZone::listIdentifiers(), For the record, hours/minutes offset are relevant only for a particular moment, but not as a default timezone." thrown in briannesbitt/Carbon.

Source

Thrown at src/Carbon/Factory.php:848

        return (bool) @preg_match('/^'.$regex.'$/', $date);
    }

    private function setDefaultTimezone(string $timezone, ?DateTimeInterface $date = null): void
    {
        $previous = null;
        $success = false;

        try {
            $success = date_default_timezone_set($timezone);
        } catch (Throwable $exception) {
            $previous = $exception;
        }

        if (!$success) {
            $suggestion = @CarbonTimeZone::create($timezone)->toRegionName($date);

            throw new InvalidArgumentException(
                "Timezone ID '$timezone' is invalid".
                ($suggestion && $suggestion !== $timezone ? ", did you mean '$suggestion'?" : '.')."\n".
                "It must be one of the IDs from DateTimeZone::listIdentifiers(),\n".
                'For the record, hours/minutes offset are relevant only for a particular moment, '.
                'but not as a default timezone.',
                0,
                $previous
            );
        }
    }
}

View on GitHub (pinned to b13f05955d)

When it happens

Trigger: Thrown at src/Carbon/Factory.php:848 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of briannesbitt/Carbon@b13f05955d (2026-08-17). Data as JSON: /api/errors/3ef2d5a93254ed13. Report an issue: GitHub.