WordPress at Your Fingertips
function is not described

ActionScheduler_wcSystemStatus::get_action_status_date() protected WC 1.0

Get oldest or newest scheduled date for a given status.

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

No Hooks.

Return

DateTime.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_action_status_date( $status, $date_type );
$status(string) (required)
Action status label/name string.
$date_type(string)
Oldest or Newest.
Default: 'oldest'

Code of ActionScheduler_wcSystemStatus::get_action_status_date() WC 6.1.0

protected function get_action_status_date( $status, $date_type = 'oldest' ) {

	$order = 'oldest' === $date_type ? 'ASC' : 'DESC';

	$action = $this->store->query_actions(
		array(
			'claimed'  => false,
			'status'   => $status,
			'per_page' => 1,
			'order'    => $order,
		)
	);

	if ( ! empty( $action ) ) {
		$date_object = $this->store->get_date( $action[0] );
		$action_date = $date_object->format( 'Y-m-d H:i:s O' );
	} else {
		$action_date = '–';
	}

	return $action_date;
}