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

  1. Create a view with a date range.
  2. Set Formatter to "AP Style"
  3. Set separator to "En dash"
  4. Apply
  5. 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.

Command icon 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

bjared created an issue. See original summary.

shelane’s picture

Assigned: Unassigned » shelane
shelane’s picture

Issue summary: View changes

I 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?

shelane’s picture

Status: Needs review » Postponed (maintainer needs more info)
shelane’s picture

I have cracked the code and found the source of the issue.

shelane’s picture

Version: 8.x-1.9 » 2.0.0
Status: Postponed (maintainer needs more info) » Active

This will need a back port for the 1.x branch.

  • shelane committed 7687b89f on 2.x
    Issue #3446560: Date Range in view was ignoring separator setting
    

  • shelane committed ba3cc55f on 8.x-1.x
    Issue #3446560: Date Range in view was ignoring separator setting
    
shelane’s picture

Status: Active » Fixed
shelane’s picture

Assigned: shelane » Unassigned

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.