Date/Time: In `wp_maybe_decline_date()`, add support for a range of days, e.g. `February 21–23`.

A potential use case is displaying multi-day events in the WordPress Events and News dashboard widget.

See #47798, #48934.
Built from https://develop.svn.wordpress.org/trunk@47098


git-svn-id: http://core.svn.wordpress.org/trunk@46898 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-01-21 23:48:04 +00:00
parent 95f5cecd77
commit 46dd0a79f6
2 changed files with 3 additions and 3 deletions

View File

@ -373,11 +373,11 @@ function wp_maybe_decline_date( $date, $format = '' ) {
if ( $decline ) { if ( $decline ) {
foreach ( $months as $key => $month ) { 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 ) { foreach ( $months_genitive as $key => $month ) {
$months_genitive[ $key ] = '$1 ' . $month; $months_genitive[ $key ] = '$1$3 ' . $month;
} }
$date = preg_replace( $months, $months_genitive, $date ); $date = preg_replace( $months, $months_genitive, $date );

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.4-alpha-47097'; $wp_version = '5.4-alpha-47098';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.