Index: application/models/application_logs/ApplicationLog.class.php =================================================================== --- application/models/application_logs/ApplicationLog.class.php (revision 114) +++ application/models/application_logs/ApplicationLog.class.php (working copy) @@ -39,7 +39,6 @@ * @return boolean */ function isToday() { - $now = DateTimeValueLib::now(); $created_on = $this->getCreatedOn(); // getCreatedOn and similar functions can return NULL @@ -47,6 +46,16 @@ return false; } + // check the user's GMT settings + $user = CompanyWebsite::instance()->getLoggedUser(); + $adj = 0; + if (isset($user)) { + $adj = $user->getTimezone(); + } + $created_on = $created_on->advance(($adj) * 60 * 60, false); + $now = DateTimeValueLib::now(); + $now = $now->advance(($adj) * 60 * 60, false); + return $now->getDay() == $created_on->getDay() && $now->getMonth() == $created_on->getMonth() && $now->getYear() == $created_on->getYear(); @@ -63,10 +72,17 @@ if (!($created_on instanceof DateTimeValue)) { return false; } - - $day_after = $created_on->advance(24 * 60 * 60, false); + + // check the user's GMT settings + $user = CompanyWebsite::instance()->getLoggedUser(); + $adj = 0; + if (isset($user)) { + $adj = $user->getTimezone(); + } + $day_after = $created_on->advance((24+$adj) * 60 * 60, false); $now = DateTimeValueLib::now(); - + $now = $now->advance(($adj) * 60 * 60, false); + return $now->getDay() == $day_after->getDay() && $now->getMonth() == $day_after->getMonth() && $now->getYear() == $day_after->getYear(); Index: environment/classes/datetimevalue/DateTimeValue.class.php =================================================================== --- environment/classes/datetimevalue/DateTimeValue.class.php (revision 114) +++ environment/classes/datetimevalue/DateTimeValue.class.php (working copy) @@ -73,17 +73,15 @@ * * @param void * @param integer $input Move the timestamp for this number of seconds - * @param boolean $mutate If true update this timestamp, else reutnr new object and dont touch internal timestamp + * @param boolean $mutate If true update this timestamp, else return new object and don't touch internal timestamp * @throws InvalidParamError */ function advance($input, $mutate = true) { $timestamp = (integer) $input; - if ($timestamp <> 0) { - if ($mutate) { - $this->setTimestamp($this->getTimestamp() + $timestamp); - } else { - return new DateTimeValue($this->getTimestamp() + $timestamp); - } // if + if ($mutate) { + $this->setTimestamp($this->getTimestamp() + $timestamp); + } else { + return new DateTimeValue($this->getTimestamp() + $timestamp); } // if } // advance