Problem/Motivation
We're running Drupal 9.5.11
When selecting "En dash" as the separator type, our date range field was still rendering with the "to" separator.
Steps to reproduce
- Create a view with a date range.
- Set Formatter to "AP Style"
- Set separator to "En dash"
- Apply
- Preview view.
Proposed resolution
I fixed this locally by doing the following:
I patched our server where I added this to DateAPStyleSettings::submitForm() after line 157:
->set('separator', $form_state->getValue('separator') ?? 'to')
I also added 'separator' to ApStyleDateRangeFieldFormatter::viewElements(), and added the following to $base_defaults in that same class:
'separator' => $config->get('separator') ?? 'to'
But, I'm not sure if both of those changes to ApStyleDateRangeFieldFormatter are required/necessary.
Issue fork date_ap_style-3446560
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
shelaneComment #3
shelaneI saw that the first time that I switched the formatter. I was still able to save it with either option. When I clicked on the field setting again, it was no longer set in red and showed the correct separator.
What version of Drupal are you on?
Comment #4
shelaneComment #5
shelaneI have cracked the code and found the source of the issue.
Comment #6
shelaneThis will need a back port for the 1.x branch.
Comment #11
shelaneComment #12
shelane