Skip to content

Commit

Permalink
Fix broken short date test with ICU >= 72.1 (#8904)
Browse files Browse the repository at this point in the history
* tests/Rcmail/Rcmail.php (test_format_date): Starting with ICU 72.1,
a NARROW NO-BREAK SPACE (NNBSP) is used instead of an ASCII space
before the meridian.  So, check for an NNBSP when using ICU >= 72.1.

References:
* https://icu.unicode.org/download/72
* https://cldr.unicode.org/index/downloads/cldr-42
* unicode-org/icu#2103
  • Loading branch information
bandali authored and alecpl committed Feb 4, 2023
1 parent 4e7efcc commit 8eed895
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/Rcmail/Rcmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,14 @@ function test_format_date()
$this->assertSame(' Mon', $rcmail->format_date($date, ' D'));
$this->assertSame('D Monday', $rcmail->format_date($date, '\\D l'));
$this->assertSame('Jun June', $rcmail->format_date($date, 'M F'));
$this->assertSame('6/1/20, 12:20 PM', $rcmail->format_date($date, 'x'));
$date_x = '6/1/20, 12:20 PM';
if (defined('INTL_ICU_VERSION')
&& version_compare(INTL_ICU_VERSION, '72.1', '>=')) {
// Starting with ICU 72.1, a NARROW NO-BREAK SPACE (NNBSP)
// is used instead of an ASCII space before the meridian.
$date_x = '6/1/20, 12:20 PM';
}
$this->assertSame($date_x, $rcmail->format_date($date, 'x'));
$this->assertSame('1591014030', $rcmail->format_date($date, 'U'));
$this->assertSame('2020-06-01T12:20:30+00:00', $rcmail->format_date($date, 'c'));
}
Expand Down

0 comments on commit 8eed895

Please sign in to comment.