From 44c6bf5914608ccc934f237e439f16a72d676dd5 Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Sun, 12 Nov 2023 17:14:30 +0100 Subject: [PATCH] EditAssetForm: use datetime-local input type for date captured field --- controllers/EditAsset.php | 5 ++++- templates/EditAssetForm.php | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/controllers/EditAsset.php b/controllers/EditAsset.php index a057529..fed113d 100644 --- a/controllers/EditAsset.php +++ b/controllers/EditAsset.php @@ -42,7 +42,8 @@ class EditAsset extends HTMLController // Key info if (isset($_POST['title'], $_POST['slug'], $_POST['date_captured'], $_POST['priority'])) { - $date_captured = !empty($_POST['date_captured']) ? new DateTime($_POST['date_captured']) : null; + $date_captured = !empty($_POST['date_captured']) ? + new DateTime(str_replace('T', ' ', $_POST['date_captured'])) : null; $slug = strtr($_POST['slug'], [' ' => '-', '--' => '-', '&' => 'and', '=>' => '', "'" => "", ":"=> "", '\\' => '-']); $asset->setKeyData(htmlspecialchars($_POST['title']), $slug, $date_captured, intval($_POST['priority'])); } @@ -50,9 +51,11 @@ class EditAsset extends HTMLController // Handle tags $new_tags = []; if (isset($_POST['tag']) && is_array($_POST['tag'])) + { foreach ($_POST['tag'] as $id_tag => $bool) if (is_numeric($id_tag)) $new_tags[] = $id_tag; + } $current_tags = array_keys($asset->getTags()); diff --git a/templates/EditAssetForm.php b/templates/EditAssetForm.php index 7028842..3589cf1 100644 --- a/templates/EditAssetForm.php +++ b/templates/EditAssetForm.php @@ -82,8 +82,9 @@ class EditAssetForm extends Template
- +