Calculated value and sent value are different in SET node

Describe the issue/error/question

In the SET node, I have a condition logic to determine whether Timestamp1 (Indent Date) >= 1 PM of Timestamp2’s (Appointment Date) previous day. Meaning, if appointment date is 5 PM on 24th, I want to see if Indent date is less than 1 PM of the 23rd.

What is the error message (if any)?

The output shown in the expression field and the output shown in the output window are different.

Please share the workflow

Logic used
{{new Date(new Date(new Date($json[“body”][“Appointment Time”]).setDate(new Date($json[“body”][“Appointment Time”]).getDate()-1)).toISOString().split(‘T’)[0].concat(" 13:00:00")).getTime() - $json[“body”][“Indent Time”] <0 ?“Late”:“On Time”}}

Share the output returned by the last node

Information on your n8n setup

  • n8n version: - [email protected]
  • Database you’re using (default: SQLite):
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: - n8n.cloud

Hey @Bala_Panneerselvam,

Is your workflow doing anything else? I believe the expression editor shows the first value and the result shows the last value so if you have multiple items being processed you will see different outputs.

That could be what you are seeing, either that or maybe the workflow timezone is out.

The expression and the output are in the same node. There is no other processing done for this variable.
I’ve set a local timezone (+5:30) for the n8n instance whereas the data is coming in UTC. But both timestamps are in UTC. Would that make any difference?

Hey @Bala_Panneerselvam,

So is your workflow just that one node or are you using other nodes that return more than one result that is being looped over?

No loop. Just one flow

Does that one flow work with multiple resutls or is it just the one result being used? Any chance of a screenshot of the workflow to help with trying to work out what is going on.

What is the vatlue of Appointment Time? I can try to reproduce it here and see if I get the same result.

This is the flow being executed.


Indent Date Value: 1637408617322
Appointment Date Value: 1637408733329

1 Like

Perfect if no one gets there before I get a chance to I will look tomorrow.

1 Like