mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +09:00
Fix incorrect parsing of some dates due to timezone difference
https://xetown.com/questions/1598582
This commit is contained in:
parent
e4bc093709
commit
ce76501f2b
1 changed files with 11 additions and 2 deletions
|
|
@ -524,18 +524,27 @@ function ztime($str)
|
|||
$year = (int)substr($str, 0, 4);
|
||||
$month = (int)substr($str, 4, 2) ?: 1;
|
||||
$day = (int)substr($str, 6, 2) ?: 1;
|
||||
if(strlen($str) >= 8)
|
||||
if(strlen($str) > 8)
|
||||
{
|
||||
$has_time = true;
|
||||
$hour = (int)substr($str, 8, 2);
|
||||
$min = (int)substr($str, 10, 2);
|
||||
$sec = (int)substr($str, 12, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
$has_time = false;
|
||||
$hour = $min = $sec = 0;
|
||||
}
|
||||
$timestamp = gmmktime($hour, $min, $sec, $month, $day, $year);
|
||||
$offset = Rhymix\Framework\Config::get('locale.internal_timezone') ?: date('Z', $timestamp);
|
||||
if ($has_time)
|
||||
{
|
||||
$offset = Rhymix\Framework\Config::get('locale.internal_timezone') ?: date('Z', $timestamp);
|
||||
}
|
||||
else
|
||||
{
|
||||
$offset = 0;
|
||||
}
|
||||
return $timestamp - $offset;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue