10000 [Locale] as of ICU 4.8+, slash ("/") and dash ("-") are interchangeab… · symfony/symfony@0d442c7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0d442c7

Browse files
committed
[Locale] as of ICU 4.8+, slash ("/") and dash ("-") are interchangeable, you can use any of them in a date/time pattern
1 parent 90d6dc3 commit 0d442c7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Symfony/Component/Locale/Stub/DateFormat/FullTransformer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,11 @@ public function getReverseMatchingRegExp($pattern)
175175
{
176176
$that = $this;
177177

178-
// $escapedPattern = preg_quote($pattern, '/');
178+
$escapedPattern = preg_quote($pattern, '/');
179179

180-
// ICU 4.8 recognizes slash ("/") in a value to be parsed as a dash ("-") when parsing a value that
181-
// TODO: how to escape the regex metachars and still recognize "/" as "-" and vice-versa?
182-
$escapedPattern = preg_replace('/\-|\//', '[\/\-]', $pattern);
180+
// ICU 4.8 recognizes slash ("/") in a value to be parsed as a dash ("-") and vice-versa
181+
// when parsing a date/time value
182+
$escapedPattern = preg_replace('/\\\[\-|\/]/', '[\/\-]', $escapedPattern);
183183

184184
$reverseMatchingRegExp = preg_replace_callback($this->regExp, function($matches) use ($that) {
185185
$length = strlen($matches[0]);

0 commit comments

Comments
 (0)
0