Skip to content

Commit

Permalink
Merge pull request #119 from ndiego/fix/woo-time-since-calculation
Browse files Browse the repository at this point in the history
Fix Woo "Time Since" calculations
  • Loading branch information
ndiego authored Dec 1, 2024
2 parents 9d23385 + 61c0498 commit 6919bda
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions includes/frontend/visibility-tests/woocommerce/rule-tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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';
Expand Down
5 changes: 5 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down

0 comments on commit 6919bda

Please sign in to comment.