TimeZone.php
authorleon <leon@roojs.com>
Fri, 27 Oct 2023 07:21:11 +0000 (15:21 +0800)
committerleon <leon@roojs.com>
Fri, 27 Oct 2023 07:21:11 +0000 (15:21 +0800)
TimeZone.php

index b32c0cd..16f2e86 100644 (file)
@@ -122,16 +122,28 @@ class Pman_Core_TimeZone extends Pman
 
     static function toRegion($tz)
     {
+        if(self::isValidTimeZone($tz)) {
+            return '';
+        }
+
         return explode('/', $tz)[0];
     }
 
     static function toArea($tz)
     {
+        if(!self::isValidTimeZone($tz)) {
+            return '';
+        }
+
         return explode('/', $tz)[1];
     }
     
     static function toTimeOffset($dt, $tz)
     {
+        if(!self::isValidTimeZone($tz)) {
+            return '';
+        }
+
         $date = new DateTime($dt, new DateTimeZone($tz));
         return $date->format('P');
     }