Skip to content

Commit

Permalink
skoro všetko funguje
Browse files Browse the repository at this point in the history
  • Loading branch information
Filip10 committed Jan 15, 2024
1 parent 8f8aa6a commit 552a107
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
5 changes: 1 addition & 4 deletions App/Controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,7 @@ public function create()
$post->setAutor($this->app->getAuth()->getLoggedUserName());
$post->setNazov($this->request()->getValue('nazov'));
$post->setPopis($this->request()->getValue('popis'));
$inputString = $this->request()->getValue('datumPublikovania');
$dateTime = new DateTime($inputString);
$outputString = $dateTime->format('d.m.Y');
$post->setDatumPublikovania($outputString);
$post->setDatumPublikovania($this->request()->getValue('datumPublikovania'));
$urlInput = (string)($this->request()->getValue('url'));
$post->setZdroj($urlInput);

Expand Down
2 changes: 1 addition & 1 deletion App/Controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ public function logout(): Response
$this->app->getAuth()->logout();
return $this->html();
}
}
}
7 changes: 4 additions & 3 deletions App/Models/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ public function getDatumPublikovania(): string
return $outputString;
}

public function setDatumPublikovania(string $datumPublikovania): void
public function setDatumPublikovania(string $datumPublikovaniaa): void
{
$formattedDate = date('Y-m-d', strtotime($datumPublikovania));
$this->datumPublikovania = $formattedDate;
$dateTime = new DateTime($datumPublikovaniaa);
$outputString = $dateTime->format('Y-m-d');
$this->datumPublikovania = $outputString;
}

public function getZdroj(): string
Expand Down

0 comments on commit 552a107

Please sign in to comment.