{@inheritdoc}

Update the PublishDate to now if the BlogPost would otherwise be published without a date.
505820
public function onBeforePublish()
    {
        /**
         * @var DBDatetime $publishDate
         */
        $publishDate = $this->dbObject('PublishDate');

        if (!$publishDate->getValue()) {
            $this->PublishDate = DBDatetime::now()->getValue();
            $this->write();
        }
    }
267633
function update(instance) {
  instance.isValid = isValid(instance._date);
  instance.timeString = instance.toString();
  return instance;
}
132293
public function setDate($t = null)
    {
        if ($t > 0) {
            $this->setText(date('Y-m-d H:i', $t));
        } else {
            $this->setText("");
        }
    }
964179
public function publishRevision()
    {
        if (empty($this->publishedDate)) {
            $this->publishedDate = new \DateTime();
        }

        $this->published = true;
    }
1355100
public function setDatePublishEnd($datePublishEnd = null)
    {
        if (is_string($datePublishEnd)) {
            $datePublishEnd = new \DateTime($datePublishEnd);
        } elseif (!$datePublishEnd instanceof \DateTime) {
            throw new \InvalidArgumentException('Expected object of type \DateTime');
        }

        $this->datePublishEnd = $datePublishEnd;
        return $this;
    }
1205271
def publish!
      current_time = Time.current
      update_columns(
        published_at: current_time,
        public_on: already_public_for?(current_time) ? public_on : current_time,
        public_until: still_public_for?(current_time) ? public_until : nil
      )
    end
465669
public function unpublishDate($var = null)
    {
        if ($var !== null) {
            $this->unpublish_date = Utils::date2timestamp($var, $this->dateformat);
        }

        return $this->unpublish_date;
    }
354195
def setCurrentDate( self, date ):
        
        if ( date == self._currentDate or not date.isValid() ):
            return
        
        self._currentDate = date
        self.markForRebuild()
        
        parent = self.parent()
        if ( not parent.signalsBlocked() ):
            parent.currentDateChanged.emit(date)
            parent.titleChanged.emit(self.title())
623511
public function getPubDate(): \Lullabot\Mpx\DataService\DateTime\DateTimeFormatInterface
    {
        if (!$this->pubDate) {
            return new NullDateTime();
        }

        return $this->pubDate;
    }
684781
public function updatedAtDate()
    {
        return $this->entity->updated_at->setTimezone($this->config->get('config.timezone'))
                                        ->format($this->config->get('config.date_format'));
    }
758461
public void update(Date lastScheduledExecutionTime, Date lastActualExecutionTime, Date lastCompletionTime) {
        this.lastScheduledExecutionTime = lastScheduledExecutionTime;
        this.lastActualExecutionTime = lastActualExecutionTime;
        this.lastCompletionTime = lastCompletionTime;
    }
994421
public Date getPublishDateTime() {
        if (getPublishDate() == null) {
            return null;
        }

        Calendar cal = Calendar.getInstance();
        cal.setTime(getPublishDate());
        cal.set(Calendar.HOUR, getPublishHour());
        cal.set(Calendar.MINUTE, getPublishMinute());
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        cal.set(Calendar.AM_PM, getPublishAmPm());
        return cal.getTime();
    }
455699
private void checkDates() {
		DateTime created = this.dateCreated;
		DateTime published = this.datePublished;
		DateTime modified = this.dateModified;
		DateTime reviewed = this.dateReviewed;
		if(
			created != null
			&& published != null
			&& published.compareTo(created) < 0
		) throw new IllegalArgumentException("published may not be before created");
		if(
			created != null
			&& modified != null
			&& modified.compareTo(created) < 0
		) throw new IllegalArgumentException("modified may not be before created");
		if(
			created != null
			&& reviewed != null
			&& reviewed.compareTo(created) < 0
		) throw new IllegalArgumentException("reviewed may not be before created");
	}
497465
public function setPublishState($publishState)
    {
        $this->publishState = $publishState;

        if ($publishState === self::PUBLISH && is_null($this->publishDate)) {
            $this->setPublishDate(new \DateTime());
        }

        return $this;
    }
545128
public function updateEventsAfterPublish()
    {
        if (!$this->eventEmittingService->isEnabled()) {
            return;
        }

        /** @var $entityManager EntityManager */
        $entityManager = $this->entityManager;

        foreach ($this->scheduledNodeEventUpdates as $documentPublish) {
            /* @var $nodeEvent NodeEvent */
            $nodeEvent = $this->eventEmittingService->emit(self::DOCUMENT_PUBLISHED, [], NodeEvent::class);
            $nodeEvent->setNode($documentPublish['documentNode']);
            $nodeEvent->setWorkspaceName($documentPublish['targetWorkspace']);
            $this->persistenceManager->whitelistObject($nodeEvent);
            $this->persistenceManager->persistAll(true);

            $parentEventIdentifier = $this->persistenceManager->getIdentifierByObject($nodeEvent);

            $qb = $entityManager->createQueryBuilder();
            $qb->update(NodeEvent::class, 'e')
                ->set('e.parentEvent', ':parentEventIdentifier')
                ->setParameter('parentEventIdentifier', $parentEventIdentifier)
                ->where('e.parentEvent IS NULL')
                ->andWhere('e.workspaceName = :workspaceName')
                ->setParameter('workspaceName', $documentPublish['workspaceName'])
                ->andWhere('e.documentNodeIdentifier = :documentNodeIdentifier')
                ->setParameter('documentNodeIdentifier', $documentPublish['documentNode']->getIdentifier())
                ->andWhere('e.eventType != :publishedEventType')
                ->setParameter('publishedEventType', self::DOCUMENT_PUBLISHED)
                ->getQuery()->execute();
        }

        $this->scheduledNodeEventUpdates = [];
    }
361774
protected void setDate(Date date, boolean firePropertyChange) {
		Date oldDate = this.date;
		this.date = date;

		if (date == null) {
			setText("");
		} else {
			String formattedDate = dateFormatter.format(date);
			try {
				setText(formattedDate);
			} catch (RuntimeException e) {
				e.printStackTrace();
			}
		}
		if (date != null && dateUtil.checkDate(date)) {
			setForeground(Color.BLACK);

		}

		if (firePropertyChange) {
			firePropertyChange("date", oldDate, date);
		}
	}
327703
private function PublishDate($baseName)
    {
        if (!$this->Content()->GetPublish()) {
            return null;
        }
        $strDate = $this->Value($baseName . 'Date');
        if (!$strDate) {
            return null;
        }
        $date = \DateTime::createFromFormat($this->dateFormat, $strDate);
        $date->setTime((int) $this->Value($baseName . 'Hour'), (int) $this->Value($baseName . 'Minute'), 0);
        return Date::FromDateTime($date);
    }