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.

git-svn-id: https://develop.svn.wordpress.org/trunk@47098 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-01-21 23:46:36 +00:00
parent 1bf8b94129
commit af39b30e28
2 changed files with 4 additions and 2 deletions

View File

@@ -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 );