Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Woo "Time Since" calculations #119

Merged
merged 1 commit into from
Dec 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions includes/frontend/visibility-tests/woocommerce/rule-tests.php
Original file line number Diff line number Diff line change
@@ -608,7 +608,7 @@ function run_customer_time_since_order_test( $rule ) {
$current = current_datetime();

// Calculate the number of days between the two dates, then add 1.
$days_between = $current->diff( $payment_date, true )->d;
$days_between = $current->diff( $payment_date, true )->days;
$days_between = ++$days_between;

$test_result = integer_value_compare( $operator, $rule_value, $days_between );
@@ -671,7 +671,7 @@ function run_customer_time_since_product_ordered_test( $rule ) {
$current = current_datetime();

// Calculate the number of days between the two dates, then add 1.
$days_between = $current->diff( $order_date, true )->d;
$days_between = $current->diff( $order_date, true )->days;
$days_between = ++$days_between;
} else {
$days_between = 'not-ordered';
@@ -748,7 +748,7 @@ function run_customer_time_since_category_ordered_test( $rule ) {
$current = current_datetime();

// Calculate the number of days between the two dates, then add 1.
$days_between = $current->diff( $order_date, true )->d;
$days_between = $current->diff( $order_date, true )->days;
$days_between = ++$days_between;
} else {
$days_between = 'not-ordered';
5 changes: 5 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -167,6 +167,11 @@ The **one exception** to this is the Screen Size block controls. Visibility by s

== Changelog ===

= 3.8.0 - 2024-12-TBD =

**Fixed**

* [WooCommerce] Fixed bug where the "Time Since Order" rule was no calculating the correct number of days.
= 3.7.0 - 2024-11-08 =

**Changed**