Fixed date_created and date_created_gmt for customers v2

This commit is contained in:
Claudio Sanches 2019-07-31 15:58:22 -03:00
parent 7d9babf1c2
commit 0b1c1dd422
1 changed files with 1 additions and 1 deletions

View File

@ -38,7 +38,7 @@ class WC_REST_Customers_V2_Controller extends WC_REST_Customers_V1_Controller {
// Format date values. // Format date values.
foreach ( $format_date as $key ) { foreach ( $format_date as $key ) {
$datetime = $data[ $key ]; $datetime = 'date_created' === $key ? get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $data[ $key ]->getTimestamp() ) ) : $data[ $key ];
$data[ $key ] = wc_rest_prepare_date_response( $datetime, false ); $data[ $key ] = wc_rest_prepare_date_response( $datetime, false );
$data[ $key . '_gmt' ] = wc_rest_prepare_date_response( $datetime ); $data[ $key . '_gmt' ] = wc_rest_prepare_date_response( $datetime );
} }