Skip to content
Snippets Groups Projects
Commit e78fb67a authored by Jared Hancock's avatar Jared Hancock
Browse files

db: Translate abbreviations like 'CDT'

parent b528df56
No related branches found
No related tags found
No related merge requests found
......@@ -166,7 +166,15 @@ class DbTimezone {
// Attempt to fetch timezone direct from the database
$TZ = db_timezone();
// SYSTEM does not describe a time zone
// Forbid timezone abbreviations like 'CDT'
if (!in_array($TZ, array('UTC', 'GMT')) && strpos($TZ, '/') === false)
// Attempt to lookup based on the abbreviation
if (!($TZ = timezone_name_from_abbr($TZ)))
// Abbreviation doesn't point to anything valid
return false;
// SYSTEM does not describe a time zone, ensure we have a valid zone
// by attempting to create an instance of DateTimeZone()
try {
new DateTimeZone($TZ);
return $TZ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment