update customer rest controller for last active date in local time (https://github.com/woocommerce/woocommerce-admin/pull/3388)
This commit is contained in:
parent
529cab809e
commit
4f71ae79a9
|
@ -166,12 +166,14 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
|
|||
* @return WP_REST_Response
|
||||
*/
|
||||
public function prepare_item_for_response( $report, $request ) {
|
||||
$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
|
||||
$data = $this->add_additional_fields_to_object( $report, $request );
|
||||
$data['date_registered_gmt'] = wc_rest_prepare_date_response( $data['date_registered'] );
|
||||
$data['date_registered'] = wc_rest_prepare_date_response( $data['date_registered'], false );
|
||||
$data['date_last_active_gmt'] = wc_rest_prepare_date_response( $data['date_last_active'] );
|
||||
$data['date_last_active'] = wc_rest_prepare_date_response( $data['date_last_active'], false );
|
||||
$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
|
||||
$data = $this->add_additional_fields_to_object( $report, $request );
|
||||
// Registered date is UTC.
|
||||
$data['date_registered_gmt'] = wc_rest_prepare_date_response( $data['date_registered'] );
|
||||
$data['date_registered'] = wc_rest_prepare_date_response( $data['date_registered'], false );
|
||||
// Last active date is local time.
|
||||
$data['date_last_active_gmt'] = wc_rest_prepare_date_response( $data['date_last_active'], false );
|
||||
$data['date_last_active'] = wc_rest_prepare_date_response( $data['date_last_active'] );
|
||||
$data = $this->filter_response_by_context( $data, $context );
|
||||
|
||||
// Wrap the data in a response object.
|
||||
|
|
Loading…
Reference in New Issue