Building integrations

Why does my integration condition fail with "can't compare offset-naive and offset-aware datetimes"?

Compare the date-time field with Last Action Performed At, or with a hidden date-time field set to now(), instead of now() inside the condition.

Fix

Short answer: The condition compares a date-time that has a time zone with now(), which has none. Compare against a value in the same format, such as Last Action Performed At from the trigger data.

Why it happens

  • Date-time fields reach the integration in UTC with a time zone attached.
  • now() inside an integration condition returns a value without a time zone.
  • The two formats can't be compared, so the condition fails.

How to fix it

  1. Open the action that has the condition and click Change next to When does this step happen?. See Adding conditions to an integration.
  2. Replace now() with Last Action Performed At from the trigger step. It holds the trigger time in the matching format.
  3. Save, retest the action, and turn on the integration.

If you need the current time from the form instead:

  1. Add a hidden Date-time field to the process form, with the formula now().
  2. Use that field in the integration condition.

If the error continues, check the text and date functions in the condition. A wrong use of toText can also break it. See Date expressions and Text expressions.

Related answers