mirror of
https://github.com/e107inc/e107.git
synced 2025-01-17 20:58:30 +01:00
Revert "Removed useless STRPTIME_COMPAT constant"
This reverts commit ce510159a9913b104e0c0a07d5018e774f47898b. Added check for 'tm_hour' key.
This commit is contained in:
parent
1d2add821e
commit
0b26a97217
@ -789,7 +789,7 @@ class e_date
|
||||
*/
|
||||
public function strptime($str, $format)
|
||||
{
|
||||
if(function_exists('strptime')) // Unix Only.
|
||||
if(STRPTIME_COMPAT !== TRUE && function_exists('strptime')) // Unix Only.
|
||||
{
|
||||
$vals = strptime($str,$format); // PHP5 is more accurate than below.
|
||||
$vals['tm_amon'] = strftime('%b', mktime(0,0,0, $vals['tm_mon'] +1) );
|
||||
@ -894,7 +894,7 @@ class e_date
|
||||
|
||||
}
|
||||
|
||||
if($ampm)
|
||||
if($ampm && isset($vals['tm_hour']))
|
||||
{
|
||||
if($vals['tm_hour'] == 12 && ($vals['tm_AMPM'] == 'AM' || $vals['tm_ampm'] == 'am'))
|
||||
{
|
||||
|
@ -30,10 +30,13 @@ if (!defined('e107_INIT'))
|
||||
|
||||
if (!function_exists('strptime'))
|
||||
{
|
||||
|
||||
define('STRPTIME_COMPAT', true);
|
||||
function strptime($str, $format)
|
||||
{
|
||||
return e107::getDate()->strptime($str,$format);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//PHP < 5.2 compatibility
|
||||
|
Loading…
x
Reference in New Issue
Block a user