IF node for date & time

Hello! Very new here - I was wondering if anyone knows how I can compare two dates and if they are equal, do x.

At present it seems that you cannot check to see if dates are equal in the same way you can with numbers/strings.

Thanks a lot in advance

Hey @Sarah_Strickland!

Welcome to the community :sparkling_heart:

The IF node currently only checks for before and after for the date. There are two possible solutions to achieve what you want to do:

  1. You can use the String type and then use the Equal operation to compare the values.
  2. You can use the Function node to write your own code for the comparison.

I would use the former approach since it is faster and works as expected. If you need to format the date and time, you can use the Date & Time node.

Hey @harshil1712

Thank you for your kind welcome and quick response!

I agree option 1 sounds the best for me. My issue is that the dates are currently in Date & Time format - would I have to use Function to convert it to a string?

Sarah

I don’t think it would be necessary. When you refer to the date in the Value field, what output do you get? You can also use default JavaScript functions in the Expression Editor.

Screenshot 2021-08-13 at 15.30.11

This expression is coming up as red - does this mean that it won’t work?
Sarah

I am not sure why they show as red but I have found that expressions do show in red, As long as you have a green result at the bottom that matches what you are after all should be good.

Thank you very much!!