added support for date specifictiy

This commit is contained in:
2026-05-26 14:01:38 +02:00
parent aefb1b6440
commit 8e56a42f7e
6 changed files with 25 additions and 5 deletions

View File

@ -146,7 +146,16 @@ function configFormHTML(layout, config, prefix) {
case 'date_spinner': {
const notBefore = config.constraints?.notBefore || '';
const notAfter = config.constraints?.notAfter || '';
const precision = config.precision || 'full';
html = `
<div class="form-group">
<label>Date precision</label>
<select id="${prefix}_precision">
<option value="full" ${precision === 'full' ? 'selected' : ''}>Year, month, and day</option>
<option value="year_month" ${precision === 'year_month' ? 'selected' : ''}>Year and month</option>
<option value="year" ${precision === 'year' ? 'selected' : ''}>Year only</option>
</select>
</div>
<div class="form-row">
<div class="form-group">
<label>Not before (question key)</label>
@ -257,6 +266,8 @@ function readConfigFromForm(layout, prefix) {
};
break;
case 'date_spinner': {
const prec = val('precision') || 'full';
if (prec && prec !== 'full') config.precision = prec;
const nb = val('notBefore');
const na = val('notAfter');
if (nb || na) {