added support for date specifictiy
This commit is contained in:
@ -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) {
|
||||
|
||||
@ -56,17 +56,19 @@
|
||||
|
||||
{
|
||||
"id": "q4",
|
||||
"_comment": "Frage mit Spinner zur Auswahl des Datums",
|
||||
"_comment": "Datumsfrage. precision: full (YYYY-MM-DD), year_month (YYYY-MM), year (YYYY).",
|
||||
"layout": "date_spinner",
|
||||
"question": "departure_country"
|
||||
"question": "departure_country",
|
||||
"precision": "year_month"
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"id": "q5",
|
||||
"_comment": "Frage mit Spinner zur Auswahl des Datums. Über constraints und notBefore und notAfter, ist es möglich das Datum nicht in der Zukunft oder Vergangenheit zu wählen.",
|
||||
"_comment": "Datumsfrage mit constraints. precision steuert Tag/Monat/Jahr-Spinner.",
|
||||
"layout": "date_spinner",
|
||||
"question": "since_in_germany",
|
||||
"precision": "year_month",
|
||||
"constraints": {
|
||||
"notBefore": "departure_country",
|
||||
"notAfter": "departure_country"
|
||||
|
||||
@ -121,12 +121,14 @@
|
||||
{
|
||||
"id": "q13",
|
||||
"layout": "date_spinner",
|
||||
"question": "departure_country"
|
||||
"question": "departure_country",
|
||||
"precision": "year_month"
|
||||
},
|
||||
{
|
||||
"id": "q14",
|
||||
"layout": "date_spinner",
|
||||
"question": "since_in_germany",
|
||||
"precision": "year_month",
|
||||
"constraints": {
|
||||
"notBefore": "departure_country"
|
||||
}
|
||||
@ -280,6 +282,7 @@
|
||||
"id": "q24",
|
||||
"layout": "date_spinner",
|
||||
"question": "provisional_accommodation_since",
|
||||
"precision": "year_month",
|
||||
"constraints": {
|
||||
"notBefore": "since_in_germany"
|
||||
}
|
||||
@ -288,6 +291,7 @@
|
||||
"id": "q25",
|
||||
"layout": "date_spinner",
|
||||
"question": "asylum_procedure_since",
|
||||
"precision": "year_month",
|
||||
"constraints": {
|
||||
"notBefore": "since_in_germany"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user