Allow the date picker to be configured without time

This commit is contained in:
Kevin MacMartin 2021-09-17 17:46:50 -04:00
parent 51d681af63
commit afce4734c1
3 changed files with 5 additions and 4 deletions

View file

@ -205,7 +205,8 @@ Models with their `$dashboard_type` set to `edit` also use:
* `string`: Single-line text input field
* `text`: Multi-line text input field
* `currency`: Text input field for currency data
* `date`: Date and time selection tool for date/time data
* `date`: Date selection tool for date/time data
* `date-time`: Date and time selection tool for date/time data
* `mkd`: Multi-line text input field with a markdown editor
* `select`: Text input via option select
* `list`: One or more items saved to a connected table

View file

@ -671,7 +671,7 @@ function editItemInit() {
// enable the datepicker for date-picker elements
$datePickers.each(function() {
$(this).flatpickr({
enableTime: true
enableTime: $(this).data("type") === "date-time"
});
});

View file

@ -49,8 +49,8 @@
<textarea class="text-input" name="{{ $column['name'] }}" id="{{ $column['name'] }}">{{ $value }}</textarea>
@elseif($type == 'currency')
<input class="currency-input" type="text" name="{{ $column['name'] }}" id="{{ $column['name'] }}" value="{{ $value }}" autocomplete="off" />
@elseif($type == 'date')
<input class="date-picker" type="text" name="{{ $column['name'] }}" id="{{ $column['name'] }}" value="{{ $value == '' ? date('Y-m-d', time()) : preg_replace('/:[0-9][0-9]$/', '', $value) }}" />
@elseif($type == 'date' || $type == 'date-time')
<input class="date-picker" type="text" name="{{ $column['name'] }}" id="{{ $column['name'] }}" data-type="{{ $type }}" value="{{ $value == '' ? date('Y-m-d', time()) : preg_replace('/:[0-9][0-9]$/', '', $value) }}" />
@elseif($type == 'mkd')
<div class="mkd-editor-container">
<textarea class="mkd-editor" name="{{ $column['name'] }}" id="{{ $column['name'] }}" value="{{ $value }}"></textarea>