Action_Scheduler\WP_CLI
System_Command::get_oldest_and_newest
Get oldest and newest scheduled dates for a given set of statuses.
Method of the class: System_Command{}
No Hooks.
Returns
Array.
Usage
// protected - for code of main (parent) or child class $result = $this->get_oldest_and_newest( $status_keys );
- $status_keys(array) (required)
- Set of statuses to find oldest & newest action for.
System_Command::get_oldest_and_newest() System Command::get oldest and newest code WC 10.5.0
protected function get_oldest_and_newest( $status_keys ) {
$oldest_and_newest = array();
foreach ( $status_keys as $status ) {
$oldest_and_newest[ $status ] = array(
'oldest' => '–',
'newest' => '–',
);
if ( 'in-progress' === $status ) {
continue;
}
$oldest_and_newest[ $status ]['oldest'] = $this->get_action_status_date( $status, 'oldest' );
$oldest_and_newest[ $status ]['newest'] = $this->get_action_status_date( $status, 'newest' );
}
return $oldest_and_newest;
}