This commit is contained in:
@ -602,6 +602,7 @@ function configFormHTML(layout, config, prefix, opts = {}) {
|
||||
const notBefore = config.constraints?.notBefore || '';
|
||||
const notAfter = config.constraints?.notAfter || '';
|
||||
const precision = config.precision || 'full';
|
||||
const dateRange = config.dateRange === 'future' ? 'future' : 'past';
|
||||
html = `
|
||||
<div class="form-group">
|
||||
<label>Date precision</label>
|
||||
@ -611,6 +612,14 @@ function configFormHTML(layout, config, prefix, opts = {}) {
|
||||
<option value="year" ${precision === 'year' ? 'selected' : ''}>Year only</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Allowed dates</label>
|
||||
<select id="${prefix}_dateRange">
|
||||
<option value="past" ${dateRange === 'past' ? 'selected' : ''}>Past (today and earlier)</option>
|
||||
<option value="future" ${dateRange === 'future' ? 'selected' : ''}>Future (today and later)</option>
|
||||
</select>
|
||||
<span class="field-hint">Controls which years the app shows. Default is past.</span>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label>Not before (question key)</label>
|
||||
@ -717,6 +726,8 @@ function readConfigFromForm(layout, prefix) {
|
||||
case 'date_spinner': {
|
||||
const prec = val('precision') || 'full';
|
||||
if (prec && prec !== 'full') config.precision = prec;
|
||||
const dateRange = val('dateRange') || 'past';
|
||||
if (dateRange === 'future') config.dateRange = 'future';
|
||||
const nb = val('notBefore');
|
||||
const na = val('notAfter');
|
||||
if (nb || na) {
|
||||
|
||||
Reference in New Issue
Block a user