Skip to content

Commit

Permalink
Add from/to to the to/from filters for relative calculations.
Browse files Browse the repository at this point in the history
  • Loading branch information
joedolson committed Jan 19, 2025
1 parent 0e57f7c commit e4edb45
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/my-calendar-output.php
Original file line number Diff line number Diff line change
Expand Up @@ -1866,20 +1866,23 @@ function my_calendar( $args ) {
* @hook mc_from_date
*
* @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`.
*
* @return {string}
*/
$from = apply_filters( 'mc_from_date', $dates['from'] );
$from = apply_filters( 'mc_from_date', $dates['from'], $dates['to'] );
/**
* 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`.
*
* @return {string}
*/
$to = apply_filters( 'mc_to_date', $dates['to'] );
$to = apply_filters( 'mc_to_date', $dates['to'], $dates['from'] );
$to = mc_date( 'Y-m-d', strtotime( $from . ' + 13 days' ) );
$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 e4edb45

Please sign in to comment.