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:
@@ -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)
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user