Updated timezone handling to be in line with other WC code.
This commit is contained in:
parent
3f9a43fdd0
commit
1b90296bba
|
@ -525,9 +525,8 @@ class WC_Admin_Reports_Orders_Stats_Data_Store extends WC_Admin_Reports_Data_Sto
|
|||
$second_order = isset( $oldest_orders[1] ) ? $oldest_orders[1] : false;
|
||||
$excluded_statuses = self::get_excluded_report_order_statuses();
|
||||
|
||||
$local_tz = new DateTimeZone( wc_timezone_string() );
|
||||
// Order is older than previous first order.
|
||||
if ( $order->get_date_created() < new WC_DateTime( $first_order->date_created, $local_tz ) &&
|
||||
if ( $order->get_date_created() < wc_string_to_datetime( $first_order->date_created ) &&
|
||||
! in_array( $order->get_status(), $excluded_statuses, true )
|
||||
) {
|
||||
self::set_customer_first_order( $customer_id, $order->get_id() );
|
||||
|
@ -538,8 +537,8 @@ class WC_Admin_Reports_Orders_Stats_Data_Store extends WC_Admin_Reports_Data_Sto
|
|||
$is_first_order = (int) $order->get_id() === (int) $first_order->order_id;
|
||||
// Order date has changed and next oldest is now the first order.
|
||||
$date_change = $second_order &&
|
||||
$order->get_date_created() > new WC_DateTime( $first_order->date_created, $local_tz ) &&
|
||||
new WC_DateTime( $second_order->date_created, $local_tz ) < $order->get_date_created();
|
||||
$order->get_date_created() > wc_string_to_datetime( $first_order->date_created ) &&
|
||||
wc_string_to_datetime( $second_order->date_created ) < $order->get_date_created();
|
||||
// Status has changed to an excluded status and next oldest order is now the first order.
|
||||
$status_change = $second_order &&
|
||||
in_array( $order->get_status(), $excluded_statuses, true );
|
||||
|
|
Loading…
Reference in New Issue