DataObjects/Events.php
[Pman.Core] / TimeZone.php
index 9c7b282..72a629f 100644 (file)
@@ -69,8 +69,7 @@ class Pman_Core_TimeZone extends Pman
         if(!empty(self::$timezones)) {
             return self::$timezones;
         }
-
-        $ce = DB_DataObject::factory('core_enum');
+         $ce = DB_DataObject::factory('core_enum');
         $ce->query("
             SELECT
                 *, TIME_FORMAT(TIMEDIFF(NOW(), CONVERT_TZ(NOW(), Name, 'UTC')), '%H:%i') as timeOffset
@@ -81,10 +80,15 @@ class Pman_Core_TimeZone extends Pman
                 AND
                 Name NOT LIKE '%/%/%'
                 AND
+                Name NOT LIKE 'right%'
+                AND
+                Name NOT LIKE 'posix%'
+                AND
                 Name NOT LIKE 'Etc%'
             ORDER BY
-                timeoffset DESC,
-                Name DESC
+                SUBSTRING_INDEX(Name, '/', 1) ASC,
+                timeoffset ASC,
+                Name ASC
         ");
 
         while($ce->fetch()) {
@@ -146,6 +150,10 @@ class Pman_Core_TimeZone extends Pman
             return '';
         }
 
+        if($dt == '0000-00-00 00:00:00' || $dt == '') {
+            $dt = 'NOW';
+        }
+
         $date = new DateTime($dt, new DateTimeZone($tz));
         return $date->format('P');
     }