Skip to content

Commit

Permalink
render "–" also when only an end-date is given
Browse files Browse the repository at this point in the history
  • Loading branch information
ottosmops committed Jan 11, 2023
1 parent 1566530 commit a465c80
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/ValueObjects/AntonDateInterval.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,6 @@ public function renderDate(bool $only_year = false, bool $nullable = false)
$html = str_replace('1er', '1<sup>er</sup>', $html);
$html = str_replace('juil.', 'juill.', $html);

$html = ltrim($html, '– - ');

return trim($html);
}
}
4 changes: 4 additions & 0 deletions tests/AntonDateIntervalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ public function test_render_date_with_no_date_string()
$actual = AntonDateInterval::compose('1553-11-02', 1, '', 0)->renderDate(false, true);
$expected = "ca. 2. Nov 1553 –";
$this->assertEquals($expected, $actual);

$actual = AntonDateInterval::compose('', 0, '1553-11-02', 0)->renderDate(false, true);
$expected = "– 2. Nov 1553";
$this->assertEquals($expected, $actual);
}

public function test_render_date_with_no_date()
Expand Down

0 comments on commit a465c80

Please sign in to comment.