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:
@@ -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