1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-21 13:11:52 +02:00

Merge pull request #3145 from SimSync/master

Fix for missing entries in strptime result array on Windows
This commit is contained in:
Cameron 2018-05-24 15:49:53 -07:00 committed by GitHub
commit 78213c4a31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 3 deletions

2
.gitignore vendored
View File

@ -12,3 +12,5 @@ e107_core/override
# Ignore Vim swap files
*.swp
*.swo
e107.htaccess
e107InstallLog.log

View File

@ -840,10 +840,31 @@ class e_date
#-- calculate wday/yday
//$vals['tm_mon'] = $vals['tm_mon'] + 1; // returns months from 0 - 11 so we need to +1
if (!isset($vals['tm_sec']))
{
$vals['tm_sec'] = 0;
}
if (!isset($vals['tm_min']))
{
$vals['tm_min'] = 0;
}
if (!isset($vals['tm_hour']))
{
$vals['tm_hour'] = 0;
}
if (!isset($vals['unparsed']))
{
$vals['unparsed'] = '';
}
$unxTimestamp = mktime($vals['tm_hour'], $vals['tm_min'], $vals['tm_sec'], ($vals['tm_mon'] + 1), $vals['tm_mday'], ($vals['tm_year'] + 1900));
$vals['tm_amon'] = strftime('%b', mktime($vals['tm_hour'], $vals['tm_min'], $vals['tm_sec'], $vals['tm_mon'] + 1));
$vals['tm_fmon'] = strftime('%B', mktime($vals['tm_hour'], $vals['tm_min'], $vals['tm_sec'], $vals['tm_mon'] + 1));
$vals['tm_wday'] = (int) strftime('%w', $unxTimestamp); // Days since Sunday (0-6)
$vals['tm_yday'] = (strftime('%j', $unxTimestamp) - 1); // Days since January 1 (0-365)