Date Range in view was ignoring separator setting

Created on 10 May 2024, 7 months ago
Updated 18 August 2024, 4 months ago

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.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024