phacility/phabricator · warning · Exception
Timezone "%s" is not a valid timezone identifier.
Error message
Timezone "%s" is not a valid timezone identifier.
What it means
The timezone setting validates the submitted value against DateTimeZone::listIdentifiers() (the IANA tz database bundled with PHP), cached in a static per request. Any value not in that list - abbreviations like EST/PDT, offsets like UTC+2, misspellings, Windows zone names, or identifiers from a different tzdata version than the server's - throws this exception.
Source
Thrown at src/applications/settings/setting/PhabricatorTimezoneSetting.php:47
// NOTE: This isn't doing anything fancy, it's just a much faster
// validator than doing all the timezone calculations to build the full
// list of options.
if (!$value) {
return;
}
static $identifiers;
if ($identifiers === null) {
$identifiers = DateTimeZone::listIdentifiers();
$identifiers = array_fuse($identifiers);
}
if (isset($identifiers[$value])) {
return;
}
throw new Exception(
pht(
'Timezone "%s" is not a valid timezone identifier.',
$value));
}
protected function getSelectOptionGroups() {
$timezones = DateTimeZone::listIdentifiers();
$now = new DateTime('@'.PhabricatorTime::getNow());
$groups = array();
foreach ($timezones as $timezone) {
$zone = new DateTimeZone($timezone);
$offset = ($zone->getOffset($now) / 60);
$groups[$offset][] = $timezone;
}
ksort($groups);
View on GitHub (pinned to 5720a38cfe)
Solutions
- Use exact IANA identifiers: 'America/Los_Angeles', 'Europe/Berlin', 'UTC'
- Source the value from the settings dropdown - it is generated from the same listIdentifiers() call
- Update PHP's timezonedb (e.g. PECL timezonedb) if a genuinely valid new zone is rejected
- Never send abbreviations, offsets, or Windows timezone display names
Example fix
// before "PST8PDT" // or "UTC-8" // after "America/Los_Angeles"
Defensive patterns
Strategy: validation
Validate before calling
$valid = array_fuse(DateTimeZone::listIdentifiers());
if (!isset($valid[$value])) {
// reject before posting: use an exact IANA identifier
} Type guard
function isValidTimezoneIdentifier($tz) {
return is_string($tz) && in_array($tz, DateTimeZone::listIdentifiers(), true);
} Prevention
- Offer the generated timezone dropdown; never free-text input
- Default to 'UTC' when unsure
- Keep PHP's timezonedb extension current on both web and CLI hosts
- Never send abbreviations (EST), offsets (UTC+2), or Windows zone names
When it happens
Trigger: Posting settings/timezone with 'EST', 'PDT', 'GMT+2', 'Pacific Standard Time' (Windows name), 'America/Los_Angeles' (typo), or a recently added IANA zone unknown to the server's older timezonedb.
Common situations: API/Conduit clients sending offsets or abbreviations; free-text inputs instead of the dropdown; PHP built with an outdated timezonedb extension rejecting newer zone names.
Related errors
- Service "%s" is unrecognized, restricted, or you do not have
- When creating a new Almanac interface via the Conduit API, y
- Device "%s" is unrecognized, restricted, or you do not have
- Interfaces must have a unique combination of network, device
- Another namespace with this name already exists. Each namesp
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/e77ec2f08c14af5f.
Report an issue: GitHub.