ActionScheduler_wcSystemStatus::get_action_status_date
Get oldest or newest scheduled date for a given status.
Метод класса: ActionScheduler_wcSystemStatus{}
Хуков нет.
Возвращает
DateTime.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_action_status_date( $status, $date_type );
- $status(строка) (обязательный)
- Action status label/name string.
- $date_type(строка)
- Oldest or Newest.
По умолчанию:'oldest'
Код ActionScheduler_wcSystemStatus::get_action_status_date() ActionScheduler wcSystemStatus::get action status date WC 10.5.2
protected function get_action_status_date( $status, $date_type = 'oldest' ) {
$order = 'oldest' === $date_type ? 'ASC' : 'DESC';
$action = $this->store->query_actions(
array(
'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;
}