IF node AND math with negative digits fails TRUE result. Bug?

Describe the problem/error/question

It seems a bug and IF not working correctly with negative digit (I`ve added separator . to digits for human readable view

I have IF node to compare overdue time in milliseconds
The idea is
When overdue is more than 2 hours send telegram msg “OVERDUE”
When overdue less than 2 hours send “FOLLOW UP” aka reminder

condition AND
fx:{{ DateTime.fromISO($json[“Due Date”]).toMillis() - DateTime.now().toMillis() }}
#Number: is less then
0
Result:-9.463.193 - TRUE

AND
{{ DateTime.fromISO($json[“Due Date”]).toMillis() - DateTime.now().toMillis() }}
with result -9.463.193
#Number: is less then
-7.200.000
Result: -9.490.249 - TRUE

it always throw me to False branch

even when I change second condition to
AND
{{ DateTime.fromISO($json[“Due Date”]).toMillis() - DateTime.now().toMillis() }}
with result --9.463.193
#Number: is LESS then
-7.200.000

it still goes to false branch

Where is my error in logic or it is a bug?
Might be there is more elegant solution to solve it?

What is the error message (if any)?

No error

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version CLOUD:

**Sorry if I am making mistake and this is silly question, I am newbee **
Tried vice versa everything and internal AI help, still cant make IF to work as expected

:thinking:

BTW it could be great to
You should add indicator to conditions to visually see if the result of every condition
1 - true
2 -false
#Feature #Support

Assistant
Currently, n8n’s If node does not display a real-time indicator for each individual condition’s result during execution. You only see the overall branch (true/false) after running the node, not the evaluation of each sub-condition.

How to see condition results now:

  • You can use the “Execute Node” feature and inspect the output, but you won’t see which specific condition was true or false—only the final result.
  • For debugging, you can temporarily split your conditions into separate If nodes or use a Set node with expressions to output the intermediate values.

> “Add visual indicators in the If node to show the result (true/false) of each individual condition after execution, not just the overall result.”

I managed to put DATE node before IF node and calculate time difference in digital format so I managed to get the result but in other way

2 Likes

Glad you got it working.

FWIW, something with the If node from the previous workflow doesn’t look quite right. It might have been enough to create a new If node. Maybe it’s a difference in the structure of the JSON behind that node in different n8n versions, but the AND AND at the top doesn’t appear on a newly created If node in version 1.90.2. Copy/pasting the node from your workflow had the extraneous conditions at the top though. (It also could be a difference between the version of n8n you have running in n8n cloud, and the version the forums uses to render workflow previews.) If you see something “suspect” like that in the editor, it’s best to start from scratch and re-create the node.

One other note about the Convert types where required option: If you can get things working without that, your results will be more reliable. It doesn’t look like you should need that enabled to compare two values that are already numeric types.

2 Likes

nice work :slight_smile:

1 Like

Considering to post for voting feature to see sub-conditions result directly in node aka
1 condition (calculations result on hover, digits in my case) and TRUE or FALSE statement regarding concerning condition
2.TRUE
3.FALSE (wrond code or input to be debugged)
4.TRUE

Thus it will be more easy to understand every outcome for every set of conditional logic.

Worth it to post?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.