Skip to content

Commit

Permalink
Merge pull request #263 from creative-commoners/pulls/6/field-validators
Browse files Browse the repository at this point in the history
FIX Set empty date to null
  • Loading branch information
GuySartorelli authored Nov 6, 2024
2 parents 1bce10d + 7c9420d commit a62fd3c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Extensions/SiteTreeContentReview.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ protected function updateCMSActions(FieldList $actions)
*
* @param SiteTree $page
*
* @return bool|DBDate
* @return null|DBDate
*/
public function getReviewDate(SiteTree $page = null)
{
Expand All @@ -209,11 +209,11 @@ public function getReviewDate(SiteTree $page = null)
$options = $this->owner->getOptions();

if (!$options) {
return false;
return null;
}

if (!$options->ReviewPeriodDays) {
return false;
return null;
}

// Failover to check on ReviewPeriodDays + LastEdited
Expand Down Expand Up @@ -508,7 +508,6 @@ public function advanceReviewDate()
' + ' . $options->ReviewPeriodDays . ' days',
DBDatetime::now()->getTimestamp()
);

$this->owner->NextReviewDate = DBDate::create()->setValue($nextDateTimestamp)->Format(DBDate::ISO_DATE);
$this->owner->write();
}
Expand Down

0 comments on commit a62fd3c

Please sign in to comment.