From d1d2c89ca9623451799c3b5c8134ba7d370c6910 Mon Sep 17 00:00:00 2001 From: Ron Rennick Date: Wed, 19 Dec 2018 13:20:15 -0400 Subject: [PATCH] convert user creation GMT datestamp to local datetime in API --- includes/api/class-wc-rest-customers-controller.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/api/class-wc-rest-customers-controller.php b/includes/api/class-wc-rest-customers-controller.php index 979a42e9ef0..70f4781e83d 100644 --- a/includes/api/class-wc-rest-customers-controller.php +++ b/includes/api/class-wc-rest-customers-controller.php @@ -28,8 +28,9 @@ class WC_REST_Customers_Controller extends WC_REST_Customers_V2_Controller { /** * Get formatted item data. * + * @param WC_Data $object WC_Data instance. + * * @since 3.0.0 - * @param WC_Data $object WC_Data instance. * @return array */ protected function get_formatted_item_data( $object ) { @@ -38,7 +39,7 @@ class WC_REST_Customers_Controller extends WC_REST_Customers_V2_Controller { // Format date values. foreach ( $format_date as $key ) { - $datetime = $data[ $key ]; + $datetime = 'date_created' == $key ? get_date_from_gmt( $data[ $key ] ) : $data[ $key ]; $data[ $key ] = wc_rest_prepare_date_response( $datetime, false ); $data[ $key . '_gmt' ] = wc_rest_prepare_date_response( $datetime ); }