projects
/
Pman.Core
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4f56fd2
)
TimeZone.php
author
leon
<leon@roojs.com>
Fri, 27 Oct 2023 07:21:11 +0000
(15:21 +0800)
committer
leon
<leon@roojs.com>
Fri, 27 Oct 2023 07:21:11 +0000
(15:21 +0800)
TimeZone.php
patch
|
blob
|
history
diff --git
a/TimeZone.php
b/TimeZone.php
index
b32c0cd
..
16f2e86
100644
(file)
--- a/
TimeZone.php
+++ b/
TimeZone.php
@@
-122,16
+122,28
@@
class Pman_Core_TimeZone extends Pman
static function toRegion($tz)
{
static function toRegion($tz)
{
+ if(self::isValidTimeZone($tz)) {
+ return '';
+ }
+
return explode('/', $tz)[0];
}
static function toArea($tz)
{
return explode('/', $tz)[0];
}
static function toArea($tz)
{
+ if(!self::isValidTimeZone($tz)) {
+ return '';
+ }
+
return explode('/', $tz)[1];
}
static function toTimeOffset($dt, $tz)
{
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');
}
$date = new DateTime($dt, new DateTimeZone($tz));
return $date->format('P');
}