diff --git a/changelog/fix-date-type b/changelog/fix-date-type new file mode 100644 index 00000000000..30c8abe3ea4 --- /dev/null +++ b/changelog/fix-date-type @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Format the display of created date for payment intent instead of timestamp. diff --git a/includes/admin/class-wc-rest-payments-payment-intents-create-controller.php b/includes/admin/class-wc-rest-payments-payment-intents-create-controller.php index 37b711ebc2e..882cda6ab5b 100644 --- a/includes/admin/class-wc-rest-payments-payment-intents-create-controller.php +++ b/includes/admin/class-wc-rest-payments-payment-intents-create-controller.php @@ -157,7 +157,7 @@ public function get_item_schema() { 'context' => [ 'view' ], ], 'created' => [ - 'description' => __( 'Timestamp for when the payment intent was created.', 'woocommerce-payments' ), + 'description' => __( 'The date when the payment intent was created.', 'woocommerce-payments' ), 'type' => 'string', 'context' => [ 'view' ], ], @@ -325,7 +325,7 @@ public function prepare_item_for_response( $item, $request ) { $prepared_item['id'] = $item->get_id(); $prepared_item['amount'] = $item->get_amount(); $prepared_item['currency'] = $item->get_currency(); - $prepared_item['created'] = $item->get_created()->getTimestamp(); + $prepared_item['created'] = $item->get_created()->format( 'Y-m-d H:i:s' ); $prepared_item['customer'] = $item->get_customer_id(); $prepared_item['payment_method'] = $item->get_payment_method_id(); $prepared_item['status'] = $item->get_status();