formatDate() public method

public formatDate ( DateTime $date = null ) : string | null
$date DateTime
return string | null
 /**
  * @param PrepareApiAttributes $event
  */
 public function addAttributes(PrepareApiAttributes $event)
 {
     if ($event->isSerializer(UserSerializer::class)) {
         $canSuspend = $event->actor->can('suspend', $event->model);
         if ($canSuspend) {
             $event->attributes['suspendUntil'] = $event->formatDate($event->model->suspend_until);
         }
         $event->attributes['canSuspend'] = $canSuspend;
     }
 }