Convert before and after dates to UTC (https://github.com/woocommerce/woocommerce-admin/pull/5819)
Fixes woocommerce/woocommerce-admin#5810
This commit is contained in:
parent
300504ea94
commit
c86563c3ac
|
@ -692,6 +692,8 @@ class DataStore extends SqlQuery {
|
||||||
$datetime_str = $query_args['before']->date( TimeInterval::$sql_datetime_format );
|
$datetime_str = $query_args['before']->date( TimeInterval::$sql_datetime_format );
|
||||||
} else {
|
} else {
|
||||||
$datetime_str = $query_args['before']->format( TimeInterval::$sql_datetime_format );
|
$datetime_str = $query_args['before']->format( TimeInterval::$sql_datetime_format );
|
||||||
|
$datetime_str = TimeInterval::convert_local_datetime_to_gmt( $datetime_str )
|
||||||
|
->format( TimeInterval::$sql_datetime_format );
|
||||||
}
|
}
|
||||||
if ( isset( $this->subquery ) ) {
|
if ( isset( $this->subquery ) ) {
|
||||||
$this->subquery->add_sql_clause( 'where_time', "AND {$table_name}.date_created <= '$datetime_str'" );
|
$this->subquery->add_sql_clause( 'where_time', "AND {$table_name}.date_created <= '$datetime_str'" );
|
||||||
|
@ -705,6 +707,8 @@ class DataStore extends SqlQuery {
|
||||||
$datetime_str = $query_args['after']->date( TimeInterval::$sql_datetime_format );
|
$datetime_str = $query_args['after']->date( TimeInterval::$sql_datetime_format );
|
||||||
} else {
|
} else {
|
||||||
$datetime_str = $query_args['after']->format( TimeInterval::$sql_datetime_format );
|
$datetime_str = $query_args['after']->format( TimeInterval::$sql_datetime_format );
|
||||||
|
$datetime_str = TimeInterval::convert_local_datetime_to_gmt( $datetime_str )
|
||||||
|
->format( TimeInterval::$sql_datetime_format );
|
||||||
}
|
}
|
||||||
if ( isset( $this->subquery ) ) {
|
if ( isset( $this->subquery ) ) {
|
||||||
$this->subquery->add_sql_clause( 'where_time', "AND {$table_name}.date_created >= '$datetime_str'" );
|
$this->subquery->add_sql_clause( 'where_time', "AND {$table_name}.date_created >= '$datetime_str'" );
|
||||||
|
|
Loading…
Reference in New Issue