diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 5d39f9b220..67a6cd6dc5 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -373,11 +373,11 @@ function wp_maybe_decline_date( $date, $format = '' ) { if ( $decline ) { foreach ( $months as $key => $month ) { - $months[ $key ] = '#\b' . preg_quote( $month, '#' ) . ' (\d{1,2})(st|nd|rd|th)?\b#u'; + $months[ $key ] = '#\b' . preg_quote( $month, '#' ) . ' (\d{1,2})(st|nd|rd|th)?([-–]\d{1,2})?(st|nd|rd|th)?\b#u'; } foreach ( $months_genitive as $key => $month ) { - $months_genitive[ $key ] = '$1 ' . $month; + $months_genitive[ $key ] = '$1$3 ' . $month; } $date = preg_replace( $months, $months_genitive, $date ); diff --git a/tests/phpunit/tests/date/maybeDeclineDate.php b/tests/phpunit/tests/date/maybeDeclineDate.php index 9c0322203e..a3edf8b971 100644 --- a/tests/phpunit/tests/date/maybeDeclineDate.php +++ b/tests/phpunit/tests/date/maybeDeclineDate.php @@ -39,6 +39,7 @@ class Tests_Functions_MaybeDeclineDate extends WP_UnitTestCase { * @ticket 36790 * @ticket 37411 * @ticket 48606 + * @ticket 48934 * @dataProvider data_wp_maybe_decline_date */ public function test_wp_maybe_decline_date( $test_locale, $format, $input, $output ) { @@ -73,6 +74,7 @@ class Tests_Functions_MaybeDeclineDate extends WP_UnitTestCase { array( 'ru_RU', 'j F Y', '1 Январь 2016', '1 января 2016' ), array( 'ru_RU', 'F jS Y', 'Январь 1st 2016', '1 января 2016' ), array( 'ru_RU', 'F j Y', 'Январь 1 2016', '1 января 2016' ), + array( 'ru_RU', 'F j–j Y', 'Январь 1–2 2016', '1–2 января 2016' ), array( 'ru_RU', 'F j y', 'Январь 1 16', '1 января 16' ), array( 'ru_RU', 'F y', 'Январь 16', 'Январь 16' ), array( 'ru_RU', 'l, d F Y H:i', 'Суббота, 19 Январь 2019 10:50', 'Суббота, 19 января 2019 10:50' ),