From f229af23f54838cd46a25697d2c3ead975cf1fc0 Mon Sep 17 00:00:00 2001 From: Viktor Miller Date: Sat, 17 Jan 2026 21:43:42 +0900 Subject: [PATCH] feat(07-01): improve date field prepopulation with format conversion Added JavaScript to convert YYYY-MM-DD dates to DD.MM.YYYY format when prepopulating date fields. This is a partial fix for the date field issues - full fix requires Formidable Forms configuration. Also updated ISSUES.md with detailed documentation of all three date field problems: initial format, picker display, and post-selection format. Co-Authored-By: Claude Sonnet 4.5 --- .planning/ISSUES.md | 35 +++++++++++++++++++------------- templates/provider-dashboard.php | 15 +++++++++++++- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/.planning/ISSUES.md b/.planning/ISSUES.md index 24188a4..f0be3bc 100644 --- a/.planning/ISSUES.md +++ b/.planning/ISSUES.md @@ -27,33 +27,40 @@ 5. Modify job detail template to display provider's company logo instead 6. Add logo display to provider dashboard (show their uploaded logo) -## Date Field Display Format (Discovered during 07-01 testing) +## Date Field Format and Pre-population Issues (Discovered during 07-01 testing) -**Issue:** The deadline date field displays in raw YYYYMMDD format instead of a user-friendly German format +**Issue:** The deadline date field has multiple formatting and pre-population problems **Current Behavior:** -- Date field on job edit form displays as "20260130" (raw format) -- Not user-friendly, difficult to read at a glance -- Inconsistent with German date conventions +1. **Initial display**: Shows as "2026-01-31" (YYYY-MM-DD) instead of German format +2. **Date picker bug**: Shows wrong date (current date instead of saved value) + - Saved: 2026-01-31 + - Picker shows: 2026-01-17 (today) +3. **Post-selection format**: Changes to "13/02/2026" (DD/MM/YYYY with slashes) **Expected Behavior:** -- Date should display in German format: "30.01.2026" (DD.MM.YYYY) -- Both in the date input field and when pre-populated -- Should be consistent across all forms (submission, edit, deactivation) +- Date should always display as "31.01.2026" (DD.MM.YYYY with dots) +- Date picker should show the saved date, not current date +- Format should remain consistent before and after selection **Location:** - Provider Dashboard edit form (`/anbieter-dashboard/?action=edit_job&job_id=XXX`) - Specifically the "Bewerbungsfrist" (deadline) field -**Impact:** Low - Cosmetic issue, doesn't affect functionality -**Priority:** Low +**Impact:** Medium - Confusing UX, users might select wrong dates +**Priority:** Medium **Phase Discovered:** 07-01 (Provider flow testing) +**Root Cause:** +This is a Formidable Forms date field configuration issue, not a plugin code issue. + **Fix Required:** -1. Check Formidable form date field settings for proper format -2. Ensure date format is set to German locale (DD.MM.YYYY) -3. Update form field configuration or add custom formatting -4. Test date display on both submission and edit forms +1. Access Formidable Forms field settings for "job_deadline2" field +2. Set date format to: `d.m.Y` (PHP date format for DD.MM.YYYY) +3. Configure datepicker options to use dots instead of slashes +4. Ensure the JavaScript prepopulation correctly parses the saved YYYY-MM-DD value +5. May need custom JavaScript to convert saved value to picker-friendly format +6. Test thoroughly: initial load, picker display, post-selection format ## Empty "Art der Stelle" Dropdown (Fixed during 07-01 testing) diff --git a/templates/provider-dashboard.php b/templates/provider-dashboard.php index d001ba0..10df84a 100644 --- a/templates/provider-dashboard.php +++ b/templates/provider-dashboard.php @@ -117,7 +117,20 @@ if ( $is_edit_mode ) { } else if (field.is(':checkbox') || field.is(':radio')) { field.filter('[value="' + value + '"]').prop('checked', true); } else { - field.val(value); + // For date fields, convert YYYY-MM-DD to DD.MM.YYYY format + if (field.attr('type') === 'date' || field.hasClass('frm_date')) { + // Check if value is in YYYY-MM-DD format + if (/^\d{4}-\d{2}-\d{2}$/.test(value)) { + var parts = value.split('-'); + var formattedDate = parts[2] + '.' + parts[1] + '.' + parts[0]; + field.val(formattedDate).trigger('change'); + console.log('Converted date from', value, 'to', formattedDate); + } else { + field.val(value); + } + } else { + field.val(value); + } } console.log('Populated field ' + fieldId + ' with:', value); } else {