Revert: force jj/mm/aaaa on the ligne_comptable date field

Back to the native <input type="date"> widget, per request.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-06 18:07:52 +02:00
co-authored by Claude Sonnet 5
parent 463a7f343c
commit c7c143e038
@@ -37,22 +37,6 @@ function figli_compta_ledger_form_alter(&$form, FormStateInterface $form_state,
}
$form['#validate'][] = 'figli_compta_ledger_validate_repartition';
// The default date widget renders as a native <input type="date">,
// whose displayed digit order (07/26/2024 vs 26/07/2024) follows the
// browser's own locale setting -- not anything Drupal or this site's
// language controls, so an English-locale browser shows the American
// mm/dd/yyyy order no matter what. Switching the date sub-element from
// 'date' (native picker) to 'text' with an explicit PHP date format
// makes Drupal itself own the display/parsing, so it's the same
// jj/mm/aaaa for everyone regardless of browser locale. Trade-off:
// loses the native calendar picker (Drupal core ships no JS date-
// picker to pair with the text variant) -- acceptable here, dates are
// typically typed directly for this kind of data entry.
if (isset($form['field_date_ligne']['widget'][0]['value'])) {
$form['field_date_ligne']['widget'][0]['value']['#date_date_element'] = 'text';
$form['field_date_ligne']['widget'][0]['value']['#date_date_format'] = 'd/m/Y';
}
// Every save must create a revision, unconditionally -- there's no
// legitimate reason to skip it for an accounting record, so don't let
// anyone opt out. #access = FALSE (rather than just leaving the