From 2bb25537b8e9d3e634f692f6dd5926e2c8968b88 Mon Sep 17 00:00:00 2001 From: Rua Haszard Date: Thu, 3 Sep 2020 15:48:14 +1200 Subject: [PATCH 1/2] update dates in ProductReviewSchema to 5.5 date-time format: - https://developer.wordpress.org/rest-api/extending-the-rest-api/schema/#format --- src/StoreApi/Schemas/ProductReviewSchema.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/StoreApi/Schemas/ProductReviewSchema.php b/src/StoreApi/Schemas/ProductReviewSchema.php index f85782a922f..8c2137602c0 100644 --- a/src/StoreApi/Schemas/ProductReviewSchema.php +++ b/src/StoreApi/Schemas/ProductReviewSchema.php @@ -51,19 +51,22 @@ public function get_properties() { ], 'date_created' => [ 'description' => __( "The date the review was created, in the site's timezone.", 'woo-gutenberg-products-block' ), - 'type' => 'date-time', + 'type' => 'string', + 'format' => 'date-time', 'context' => [ 'view', 'edit' ], 'readonly' => true, ], 'formatted_date_created' => [ 'description' => __( "The date the review was created, in the site's timezone in human-readable format.", 'woo-gutenberg-products-block' ), 'type' => 'string', + 'format' => 'date-time', 'context' => [ 'view', 'edit' ], 'readonly' => true, ], 'date_created_gmt' => [ 'description' => __( 'The date the review was created, as GMT.', 'woo-gutenberg-products-block' ), - 'type' => 'date-time', + 'type' => 'string', + 'format' => 'date-time', 'context' => [ 'view', 'edit' ], 'readonly' => true, ], From a7943a1d166d2ffe011d4cc63c1d64a39390bdcd Mon Sep 17 00:00:00 2001 From: Rua Haszard Date: Thu, 3 Sep 2020 15:57:06 +1200 Subject: [PATCH 2/2] fix formatted date schema - is human readable, not 'date-time' --- src/StoreApi/Schemas/ProductReviewSchema.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/StoreApi/Schemas/ProductReviewSchema.php b/src/StoreApi/Schemas/ProductReviewSchema.php index 8c2137602c0..70023d78fe7 100644 --- a/src/StoreApi/Schemas/ProductReviewSchema.php +++ b/src/StoreApi/Schemas/ProductReviewSchema.php @@ -59,7 +59,6 @@ public function get_properties() { 'formatted_date_created' => [ 'description' => __( "The date the review was created, in the site's timezone in human-readable format.", 'woo-gutenberg-products-block' ), 'type' => 'string', - 'format' => 'date-time', 'context' => [ 'view', 'edit' ], 'readonly' => true, ],