}
if (isset($conditionData['registrationDateEnd'])) {
+ $registrationDateEnd = \DateTime::createFromFormat(
+ 'Y-m-d',
+ $conditionData['registrationDateEnd'],
+ TIMEZONE
+ );
+ $registrationDateEnd->setTime(23, 59, 59);
$objectList->getConditionBuilder()->add(
'user_table.registrationDate < ?',
- [\strtotime($conditionData['registrationDateEnd']) + 86400]
+ [$registrationDateEnd->getTimestamp()]
);
}
if (isset($conditionData['registrationDateStart'])) {
+ $registrationDateStart = \DateTime::createFromFormat(
+ 'Y-m-d',
+ $conditionData['registrationDateStart'],
+ TIMEZONE
+ );
+ $registrationDateStart->setTime(0, 0, 0);
$objectList->getConditionBuilder()->add(
'user_table.registrationDate >= ?',
- [\strtotime($conditionData['registrationDateStart'])]
+ [$registrationDateStart->getTimestamp()]
);
}
}
public function checkUser(Condition $condition, User $user)
{
/** @noinspection PhpUndefinedFieldInspection */
- $registrationDateStart = $condition->registrationDateStart;
- if ($registrationDateStart !== null && $user->registrationDate < \strtotime($registrationDateStart)) {
- return false;
+ $registrationDateStart = \DateTime::createFromFormat('Y-m-d', $condition->registrationDateStart, TIMEZONE);
+ if ($registrationDateStart !== false) {
+ $registrationDateStart->setTime(0, 0, 0);
+ if ($user->registrationDate < $registrationDateStart->getTimestamp()) {
+ return false;
+ }
}
/** @noinspection PhpUndefinedFieldInspection */
- $registrationDateEnd = $condition->registrationDateEnd;
- if ($registrationDateEnd !== null && $user->registrationDate >= \strtotime($registrationDateEnd) + 86400) {
- return false;
+ $registrationDateEnd = \DateTime::createFromFormat('Y-m-d', $condition->registrationDateEnd, TIMEZONE);
+ if ($registrationDateEnd !== false) {
+ $registrationDateEnd->setTime(23, 59, 59);
+ if ($user->registrationDate >= $registrationDateEnd->getTimestamp()) {
+ return false;
+ }
}
return true;
{
$registrationDateEnd = $registrationDateStart = null;
if (\strlen($this->registrationDateStart)) {
- $registrationDateStart = @\strtotime($this->registrationDateStart);
+ $registrationDateStart = \DateTime::createFromFormat('Y-m-d', $this->registrationDateStart, TIMEZONE);
if ($registrationDateStart === false) {
$this->errorMessage = 'wcf.condition.timestamp.error.invalidStart';
}
}
if (\strlen($this->registrationDateEnd)) {
- $registrationDateEnd = @\strtotime($this->registrationDateEnd);
+ $registrationDateEnd = \DateTime::createFromFormat('Y-m-d', $this->registrationDateEnd, TIMEZONE);
if ($registrationDateEnd === false) {
$this->errorMessage = 'wcf.condition.timestamp.error.invalidEnd';