Make WordPress Core


Ignore:
Timestamp:
01/21/2020 11:46:36 PM (5 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r47088 r47098  
    374374        if ( $decline ) {
    375375            foreach ( $months as $key => $month ) {
    376                 $months[ $key ] = '#\b' . preg_quote( $month, '#' ) . ' (\d{1,2})(st|nd|rd|th)?\b#u';
     376                $months[ $key ] = '#\b' . preg_quote( $month, '#' ) . ' (\d{1,2})(st|nd|rd|th)?([-–]\d{1,2})?(st|nd|rd|th)?\b#u';
    377377            }
    378378
    379379            foreach ( $months_genitive as $key => $month ) {
    380                 $months_genitive[ $key ] = '$1 ' . $month;
     380                $months_genitive[ $key ] = '$1$3 ' . $month;
    381381            }
    382382
Note: See TracChangeset for help on using the changeset viewer.