| 381 | |
| 382 | if ( isset( $event['end_date'] ) ) { |
| 383 | $end_timestamp = strtotime( $event['end_date'] ); |
| 384 | $formatted_end_date = date_i18n( __( 'l, M j, Y' ), $end_timestamp ); |
| 385 | |
| 386 | if ( 'meetup' !== $response_body['events'][ $key ]['type'] && $response_body['events'][ $key ]['formatted_date'] !== $formatted_end_date ) { |
| 387 | $month_start = date_i18n( __( 'M' ), $timestamp ); |
| 388 | $month_end = date_i18n( __( 'M' ), $end_timestamp ); |
| 389 | |
| 390 | if ( $month_start === $month_end ) { |
| 391 | /* Translators: %1$s is for the month, %2$d is for the starting day, %2$d is for the ending day, %4$d is for the year */ |
| 392 | $response_body['events'][ $key ]['formatted_date'] = sprintf( |
| 393 | __( '%1$s %2$d - %3$d, %4$d' ), |
| 394 | $month_start, |
| 395 | date_i18n( __( 'j' ), $timestamp ), |
| 396 | date_i18n( __( 'j' ), $end_timestamp ), |
| 397 | date_i18n( __( 'Y' ), $timestamp ) |
| 398 | ); |
| 399 | } else { |
| 400 | /* Translators: %1$s is for the starting month, %2$d is for the starting day, %3$s is for the ending month, %4$d is for the ending day, %5$d is for the year */ |
| 401 | $response_body['events'][ $key ]['formatted_date'] = sprintf( |
| 402 | __( '%1$s %2$d - %3$s %4$d, %5$d' ), |
| 403 | $month_start, |
| 404 | date_i18n( __( 'j' ), $timestamp ), |
| 405 | $month_end, |
| 406 | date_i18n( __( 'j' ), $end_timestamp ), |
| 407 | date_i18n( __( 'Y' ), $timestamp ) |
| 408 | ); |
| 409 | } |
| 410 | } |
| 411 | } |