From 2c0f791003344d6a916019ea7fe1753778af6bcb Mon Sep 17 00:00:00 2001 From: Denys Davydov Date: Fri, 14 Apr 2023 15:56:34 +0300 Subject: [PATCH] #1678 source fb marketing: another fix --- .../source_facebook_marketing/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/utils.py b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/utils.py index eb442b951832a..b0a52abf4a777 100644 --- a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/utils.py +++ b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/utils.py @@ -20,7 +20,7 @@ def validate_start_date(start_date: DateTime) -> DateTime: now = pendulum.now(tz=start_date.tzinfo) today = now.replace(microsecond=0, second=0, minute=0, hour=0) retention_date = today.subtract(months=DATA_RETENTION_PERIOD) - if retention_date.day != start_date.day: + if retention_date.day != today.day: # `.subtract(months=37)` can be erroneous, for instance: # 2023-03-31 - 37 month = 2020-02-29 which is incorrect, should be 2020-03-01 # that's why we're adjusting the date to the 1st day of the next month