ENHANCEMENT: you cannot trust datetime-local, yet

This commit is contained in:
Jeroen De Meerleer 2021-07-30 15:14:04 +02:00
parent e45f756177
commit 8fae1c89e1
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
3 changed files with 8 additions and 6 deletions

View File

@ -153,8 +153,10 @@ function handleSecretCheckbox(event) {
function initEternalCheckbox() {
document.querySelector('.lastrun-eternal').addEventListener('click', event => {
document.querySelector('#lastrunselector').prop('disabled', document.querySelector(this).prop('checked'));
document.querySelector('#lastrunselector').prop('value', '');
let nextrunselector = document.querySelector('#lastrunselector');
nextrunselector.disabled = event.target.checked;
nextrunselector.placeholder = event.target.checked ? '' : nextrunselector.dataset.placeholder;
nextrunselector.value = '';
})
}

View File

@ -30,7 +30,7 @@
<div class="mb-3">
<label for="nextrun">Next run</label>
<input type="datetime-local" autocomplete="off" id="nextrunselector" class="form-control datetimepicker-input" data-target="#nextrunselector" data-bs-toggle="datetimepicker" name="nextrun">
<input type="text" autocomplete="off" pattern="[0-9]{2}\/[0-9]{2}\/[0-9]{4} [0-9]{2}:[0-9]{2}:[0-9]{2}"placeholder="{{ date() | date("d/m/Y H:i:s")}}" step="1" id="nextrunselector" class="form-control datetimepicker-input" data-target="#nextrunselector" data-bs-toggle="datetimepicker" name="nextrun">
</div>
<div class="mb-3">
@ -40,7 +40,7 @@
<input type="checkbox" name="lastrun-eternal" class="lastrun-eternal" placeholder="value" value="true" {% if attribute(data, 'lastrun-eternal') is not empty %} checked{% endif %}>
</div>
<span class="input-group-text border-start-0">Eternal</span>
<input type="datetime-local" autocomplete="off" id="lastrunselector" class="form-control datetimepicker-input" data-target="#lastrunselector" data-bs-toggle="datetimepicker" name="lastrun">
<input type="text" autocomplete="off" pattern="[0-9]{2}\/[0-9]{2}\/[0-9]{4} [0-9]{2}:[0-9]{2}:[0-9]{2}" placeholder="{{ date() | date("d/m/Y H:i:s")}}" data-placeholder="{{ date() | date("d/m/Y H:i:s")}}" id="lastrunselector" class="form-control datetimepicker-input" data-target="#lastrunselector" data-bs-toggle="datetimepicker" name="lastrun">
</div>
</div>

View File

@ -27,7 +27,7 @@
</div>
<div class="mb-3">
<label for="nextrun">Next run</label>
<input type="text" autocomplete="off" id="nextrunselector" class="form-control datetimepicker-input" data-target="#nextrunselector" data-bs-toggle="datetimepicker" name="nextrun" value="{{ nextrun | date("d/m/Y H:i:s")}}">
<input type="text" autocomplete="off" pattern="[0-9]{2}\/[0-9]{2}\/[0-9]{4} [0-9]{2}:[0-9]{2}:[0-9]{2}" placeholder="{{ date() | date("d/m/Y H:i:s")}}" id="nextrunselector" class="form-control datetimepicker-input" data-target="#nextrunselector" data-bs-toggle="datetimepicker" name="nextrun" value="{{ nextrun | date("d/m/Y H:i:s")}}">
</div>
<div class="mb-3">
<label for="lastrun">Last run</label>
@ -36,7 +36,7 @@
<input type="checkbox" name="lastrun-eternal" class="lastrun-eternal" placeholder="value" value="true"{% if lastrun is empty %} checked{% endif %}>
</div>
<span class="input-group-text border-start-0">Eternal</span>
<input type="text" autocomplete="off" id="lastrunselector" class="form-control datetimepicker-input" data-target="#lastrunselector" data-bs-toggle="datetimepicker" name="lastrun"{% if lastrun is empty %} disabled{% else %} value="{{ lastrun | date("d/m/Y H:i:s")}}"{% endif %}>
<input type="text" autocomplete="off" pattern="[0-9]{2}\/[0-9]{2}\/[0-9]{4} [0-9]{2}:[0-9]{2}:[0-9]{2}" data-placeholder="{{ date() | date("d/m/Y H:i:s")}}" id="lastrunselector" class="form-control datetimepicker-input" data-target="#lastrunselector" data-bs-toggle="datetimepicker" name="lastrun"{% if lastrun is empty %} disabled{% else %} value="{{ lastrun | date("d/m/Y H:i:s")}}"{% endif %}>
</div>
</div>