Skip to content

Commit

Permalink
Add an array parameter for filtering from/to
Browse files Browse the repository at this point in the history
  • Loading branch information
joedolson committed Jan 19, 2025
1 parent 5e18d82 commit 26624ad
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/my-calendar-output.php
Original file line number Diff line number Diff line change
Expand Up @@ -1867,21 +1867,23 @@ function my_calendar( $args ) {
*
* @param {string} $from Start date of events shown in main calendar shortcode in format `yyyy-mm-dd`.
* @param {string} $to Ending date of current view in format `yyyy-mm-dd`.
* @param {array} $params Calendar view parameters.
*
* @return {string}
*/
$from = apply_filters( 'mc_from_date', $dates['from'], $dates['to'] );
$from = apply_filters( 'mc_from_date', $dates['from'], $dates['to'], $params );
/**
* Filter the calendar end date.
*
* @hook mc_to_date
*
* @param {string} $to End date of events shown in main calendar shortcode in format `yyyy-mm-dd`.
* @param {string} $from Starting date of current view in format `yyyy-mm-dd`.
* @param {array} $params Calendar view parameters.
*
* @return {string}
*/
$to = apply_filters( 'mc_to_date', $dates['to'], $dates['from'] );
$to = apply_filters( 'mc_to_date', $dates['to'], $dates['from'], $params );
$from = ( 'day' === $params['time'] ) ? mc_date( 'Y-m-d', $current, false ) : $from;
$to = ( 'day' === $params['time'] ) ? mc_date( 'Y-m-d', $current, false ) : $to;
$query = array(
Expand Down

0 comments on commit 26624ad

Please sign in to comment.