WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Admin\API\Reports

TimeInterval::next_week_start() public WC 1.0

Returns DateTime object representing the next week start, or previous week end if reversed.

{} It's a method of the class: TimeInterval{}

No Hooks.

Return

DateTime.

Usage

$result = TimeInterval::next_week_start( $datetime, $reversed );
$datetime(DateTime) (required)
Date and time.
$reversed(true|false)
Going backwards in time instead of forward.
Default: false

Code of TimeInterval::next_week_start() WC 6.1.0

public static function next_week_start( $datetime, $reversed = false ) {
	$first_day_of_week = absint( get_option( 'start_of_week' ) );
	$initial_week_no   = self::week_number( $datetime, $first_day_of_week );
	$failsafe_count    = 0;

	do {
		if ( $failsafe_count++ >= 7 ) {
			break;
		}
		$datetime        = self::next_day_start( $datetime, $reversed );
		$current_week_no = self::week_number( $datetime, $first_day_of_week );
	} while ( $current_week_no === $initial_week_no );

	// The week boundary is actually next midnight when going in reverse, so set it to day -1 at 23:59:59.
	if ( $reversed ) {
		$timestamp            = (int) $datetime->format( 'U' );
		$end_of_day_timestamp = floor( $timestamp / DAY_IN_SECONDS ) * DAY_IN_SECONDS + DAY_IN_SECONDS - 1;
		$datetime->setTimestamp( $end_of_day_timestamp );
	}

	return $datetime;
}