EditAssetForm: use datetime-local input type for date captured field
This commit is contained in:
parent
b48dd324cd
commit
44c6bf5914
@ -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());
|
||||
|
||||
|
@ -82,8 +82,9 @@ class EditAssetForm extends Template
|
||||
<div class="row mb-2">
|
||||
<label class="col-form-label col-sm-3">Date captured:</label>
|
||||
<div class="col-sm">
|
||||
<input class="form-control" name="date_captured" size="30" value="',
|
||||
$date_captured ? $date_captured->format('Y-m-d H:i:s') : '', '" placeholder="Y-m-d H:i:s">
|
||||
<input class="form-control" type="datetime-local" step="1"
|
||||
name="date_captured" size="30" placeholder="Y-m-d H:i:s" value="',
|
||||
$date_captured ? $date_captured->format('Y-m-d H:i:s') : '', '">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-2">
|
||||
|
Loading…
Reference in New Issue
Block a user