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 <noreply@anthropic.com>
This commit is contained in:
2026-01-17 21:43:42 +09:00
parent 18ddcd5e0a
commit f229af23f5
2 changed files with 35 additions and 15 deletions

View File

@@ -27,33 +27,40 @@
5. Modify job detail template to display provider's company logo instead 5. Modify job detail template to display provider's company logo instead
6. Add logo display to provider dashboard (show their uploaded logo) 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:** **Current Behavior:**
- Date field on job edit form displays as "20260130" (raw format) 1. **Initial display**: Shows as "2026-01-31" (YYYY-MM-DD) instead of German format
- Not user-friendly, difficult to read at a glance 2. **Date picker bug**: Shows wrong date (current date instead of saved value)
- Inconsistent with German date conventions - 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:** **Expected Behavior:**
- Date should display in German format: "30.01.2026" (DD.MM.YYYY) - Date should always display as "31.01.2026" (DD.MM.YYYY with dots)
- Both in the date input field and when pre-populated - Date picker should show the saved date, not current date
- Should be consistent across all forms (submission, edit, deactivation) - Format should remain consistent before and after selection
**Location:** **Location:**
- Provider Dashboard edit form (`/anbieter-dashboard/?action=edit_job&job_id=XXX`) - Provider Dashboard edit form (`/anbieter-dashboard/?action=edit_job&job_id=XXX`)
- Specifically the "Bewerbungsfrist" (deadline) field - Specifically the "Bewerbungsfrist" (deadline) field
**Impact:** Low - Cosmetic issue, doesn't affect functionality **Impact:** Medium - Confusing UX, users might select wrong dates
**Priority:** Low **Priority:** Medium
**Phase Discovered:** 07-01 (Provider flow testing) **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:** **Fix Required:**
1. Check Formidable form date field settings for proper format 1. Access Formidable Forms field settings for "job_deadline2" field
2. Ensure date format is set to German locale (DD.MM.YYYY) 2. Set date format to: `d.m.Y` (PHP date format for DD.MM.YYYY)
3. Update form field configuration or add custom formatting 3. Configure datepicker options to use dots instead of slashes
4. Test date display on both submission and edit forms 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) ## Empty "Art der Stelle" Dropdown (Fixed during 07-01 testing)

View File

@@ -117,7 +117,20 @@ if ( $is_edit_mode ) {
} else if (field.is(':checkbox') || field.is(':radio')) { } else if (field.is(':checkbox') || field.is(':radio')) {
field.filter('[value="' + value + '"]').prop('checked', true); field.filter('[value="' + value + '"]').prop('checked', true);
} else { } 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); console.log('Populated field ' + fieldId + ' with:', value);
} else { } else {