wp-pay-core icon indicating copy to clipboard operation
wp-pay-core copied to clipboard

Calculating periods created is wrong with a subscription phase with an end date

Open remcotolsma opened this issue 8 months ago • 1 comments

https://github.com/pronamic/wp-pay-core/blob/bd197f4b1d3ddd2947c8d0a210171c2e7482bac7/src/Subscriptions/SubscriptionPhase.php#L293-L312

The next payment date can go far beyond the end date of a subscription phase.

Scherm­afbeelding 2024-06-19 om 12 25 03

Should we add something like this?

if ( null !== $this->end_date ) {
	$next_date = \min( $next_date, $this->end_date );
}

Probably also rename the variable $next_date to $anchor_date or $pointer_date?

CC @rvdsteege

remcotolsma avatar Jun 19 '24 10:06 remcotolsma