Problem/Motivation

When "Reduce output duplication" is used with German date format, an essential character (period) is removed on date ranges within one month. For example, if the range is 5. Januar 2020 - 13. Januar 2020, it can be reduced to 5. - 13. Januar 2020, note the period behind the "5". Smart Date removes that character and leaves 5 - 13. Januar 2020.

Proposed resolution

Similarly, the code to save the "S" date format could be re-used here:

if ($s_loc = strpos($settings['date_format'], 'S', $day_loc)) {
        $offset = 1 + $s_loc - $day_loc;
      }
      elseif ($p_loc = strpos($settings['date_format'], '.', $day_loc)) { // <== This is the new part.
        $offset = 1 + $p_loc - $day_loc;
      }
      else {
        $offset = 1;
      }

This is of course a custom hack that works for me, maybe that can be turned into an option where the user can decide on date format code ("S") or special character (".") to keep when reducing date output.

Comments

Paul Broon created an issue. See original summary.

mandclu’s picture

Status: Active » Needs work

As I understand it, another common format for dates in German looks like "12.01.2019". Based on this suggestion, a formatted range would look like "12. - 14.01.2019". Would this be correct?

broon’s picture

Sorry, issue got drowned in my list.

Your assumption is correct. The common short form in German is d.m.Y and the combined date for two dates within one month would be d. - d.m.Y.

  • mandclu committed b20a50a on 3.0.x
    Issue #3163066: "Reduce output duplication" removes period from German...
mandclu’s picture

mandclu’s picture

Status: Needs work » Fixed

Tested your code and verified that it works. Thanks for identifying this, and for providing a fix. Merged in, should have a new release out soon.

Status: Fixed » Closed (fixed)

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