jenkins-bot has submitted this change and it was merged.

Change subject: Use actual minus sign for timestamp in DateTime diffs
......................................................................


Use actual minus sign for timestamp in DateTime diffs

Warning, this currently does not round-trip. You can not copy-paste
this value any more because the current parser requires the Z in the
end and does not accept the actual minus sign. I will change this to
allow for a full round-trip, see https://github.com/DataValues/Time/pull/27

Change-Id: Icf9bfc6dddd1c26651e01d7e8b65295275f995a2
---
M lib/includes/formatters/TimeDetailsFormatter.php
M lib/tests/phpunit/formatters/TimeDetailsFormatterTest.php
2 files changed, 4 insertions(+), 2 deletions(-)

Approvals:
  Daniel Kinzler: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/includes/formatters/TimeDetailsFormatter.php 
b/lib/includes/formatters/TimeDetailsFormatter.php
index f4f537a..008fd25 100644
--- a/lib/includes/formatters/TimeDetailsFormatter.php
+++ b/lib/includes/formatters/TimeDetailsFormatter.php
@@ -106,10 +106,12 @@
                        return htmlspecialchars( $time );
                }
 
+               // Actual MINUS SIGN (U+2212) instead of HYPHEN-MINUS (U+002D)
+               $sign = $matches[1] !== '+' ? "\xE2\x88\x92" : '+';
                // Warning, never cast the year to integer to not run into 
32-bit integer overflows!
                $year = ltrim( $matches[2], '0' );
                // Keep the sign. Pad the year. Keep month, day, and time. Drop 
the trailing "Z".
-               return htmlspecialchars( $matches[1] . str_pad( $year, 4, '0', 
STR_PAD_LEFT ) . $matches[3] );
+               return htmlspecialchars( $sign . str_pad( $year, 4, '0', 
STR_PAD_LEFT ) . $matches[3] );
        }
 
        /**
diff --git a/lib/tests/phpunit/formatters/TimeDetailsFormatterTest.php 
b/lib/tests/phpunit/formatters/TimeDetailsFormatterTest.php
index 2cd60e1..d148440 100644
--- a/lib/tests/phpunit/formatters/TimeDetailsFormatterTest.php
+++ b/lib/tests/phpunit/formatters/TimeDetailsFormatterTest.php
@@ -61,7 +61,7 @@
                        ),
                        array(
                                new TimeValue( '-099999-01-01T00:00:00Z', 0, 0, 
0, $day, $gregorian ),
-                               
'@.*<td[^<>]*isotime">-99999-01-01T00:00:00</td>.*@s'
+                               
'@.*<td[^<>]*isotime">\xE2\x88\x9299999-01-01T00:00:00</td>.*@s'
                        ),
                        array(
                                new TimeValue( '+2001-01-01T00:00:00Z', 0, 0, 
0, $day, TimeFormatter::CALENDAR_JULIAN ),

-- 
To view, visit https://gerrit.wikimedia.org/r/191641
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Icf9bfc6dddd1c26651e01d7e8b65295275f995a2
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to