sort the timezone
authorleon <leon@roojs.com>
Tue, 7 Nov 2023 05:31:20 +0000 (13:31 +0800)
committerleon <leon@roojs.com>
Tue, 7 Nov 2023 05:31:20 +0000 (13:31 +0800)
TimeZone.php

index 1d8629d..72a629f 100644 (file)
@@ -86,8 +86,9 @@ class Pman_Core_TimeZone extends Pman
                 AND
                 Name NOT LIKE 'Etc%'
             ORDER BY
-                timeoffset DESC,
-                Name DESC
+                SUBSTRING_INDEX(Name, '/', 1) ASC,
+                timeoffset ASC,
+                Name ASC
         ");
 
         while($ce->fetch()) {
@@ -149,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');
     }