diff --git a/src/ValueParsers/MonthNameUnlocalizer.php b/src/ValueParsers/MonthNameUnlocalizer.php index ac90602..f44ae50 100644 --- a/src/ValueParsers/MonthNameUnlocalizer.php +++ b/src/ValueParsers/MonthNameUnlocalizer.php @@ -46,6 +46,10 @@ public function unlocalize( $date ) { if ( !is_string( $search ) ) { continue; } + if ( !preg_match( '/\\p{L}/', $search ) ) { + // no letters in here (e.g. "1." for "jan"), do not use (might match day rather than month: T325988) + continue; + } $unlocalized = str_replace( $search, $replace, $date, $count ); diff --git a/tests/ValueParsers/MonthNameUnlocalizerTest.php b/tests/ValueParsers/MonthNameUnlocalizerTest.php index d7baa17..7a98288 100644 --- a/tests/ValueParsers/MonthNameUnlocalizerTest.php +++ b/tests/ValueParsers/MonthNameUnlocalizerTest.php @@ -79,6 +79,10 @@ public function localizedDateProvider() { array( '2000', '2000', array( '2' => 'February', ) ), + // And others (e.g. cs) just repeat the number of the month with punctuation + array( '5. 4. 1891', '5. 4. 1891', array( + '5.' => 'May', + ) ), ); }