How can I compare dates in filters/conditions within IFTTT?
Asked by Manuel_vA:

++Goal++

I want to have a condition for an IFTTT that compares two date fields and evaluates to true in case my condition is met.

++Condition++

The [Confiforms Filter Documentation](https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Filters) is stated to be valid for Cloud as well.

Based on it I tested a few syntax variants and these are my most promising ones:

```
-?([entry.DueDate.timestamp]-5184000000):<_now

- ([entry.DueDate.timestamp]-5184000000):<[now]

-?([entry.DueDate.timestamp.add(-5184000000)]:<_now]

- [entry.DueDate.timestamp.add(-5184000000)]<_now
```

- 'DueDate' -\> custom field in my Confiforms form

- 5184000000 -\> 60 days in ms.

I want the condition to be met 60 days before my 'DueDate' approaches. So I subtract 5184000000 ms from the timestamp \[entry.DueDate.timestamp\] and compare it with \[now\].

My IFTTT fires like expected when I leave the condition/filter out.

++Simplified setup++

I tried to simplify things by testing a simpler filter/condition in my IFTTT:

```
//Simpler Dates:

_yesterday:<_today


//Hard-coded dates:

[date20230612]:<[date20230615]


//Hard-coded numbers (3 variants):

2:>1
2>1
(2>1)
```

++None++ of these tests did work either!

When I only wrote one single number in the condition/filter it got interpreted as true. I assume my problem is primarily the comparison operator.

Any kind of help is appreciated!


Answers:
author: Alex Medved _ConfiForms_
body: Hi [@Manuel_vA](/t5/user/viewprofilepage/user-id/1475364)

```
DueDate.add(-5184000000)):<[entry._now]
```

Alex

comments: author: Manuel_vA
body: Hi [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630) ,

thanks a lot for your reply! I tried your answer but unfortunately the IFTTT still doesn't trigger: (when giving appropriate input)

![Screenshot 2023-06-26 at 23.12.29.png](https://community.atlassian.com/t5/image/serverpage/image-id/265155iF68F06733C2C15EC/image-size/large?v=v2&px=999 "Screenshot 2023-06-26 at 23.12.29.png")

It seemed to me like there sneaked in one too many bracket. So I also tried your expression this way:

```
DueDate.add(-5184000000):<[entry._now]

```

But unfortunately it doesn't trigger my IFTTT both ways.

Also this simple filter condition doesn't work. Shouldn't this work for sure?

![Screenshot 2023-06-26 at 23.23.36.png](https://community.atlassian.com/t5/image/serverpage/image-id/265157i6A4CC216D2F7F53D/image-size/large?v=v2&px=999 "Screenshot 2023-06-26 at 23.23.36.png")

But it works if I leave out the comparison operator and e.g. only write '2'.

Nice Greetings

Manuel


author: Alex Medved _ConfiForms_
body: Hi

What does not work for you?

The condition we have will trigger when someone selected a DueDate that is 60 days and more in the PAST

Alex


author: Manuel vA
body: -


author: Manuel_vA
body: Hi [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630) ,

sorry for my late reply!

> The condition we have will trigger when someone selected a DueDate that is 60 days and more in the PAST

This is exactly what does not happen in my form. With this setup (correct input data, correct filter syntax) the IFTTT still doesn't trigger.

> What does not work for you?

I assume that I have another problem in my form that causes this behaviour. Because not only your suggested solution doesn't work in my IFTTT. All filter/conditiosn don't work that include a comparison ( operators: \< or \> etc) in any way. So I guess I have other problem(s).

Thanks a lot for your help!

I will mark this question as answered since it should help other people.


author: Manuel vA
body: I finally found a solution for my question above that worked for me:

```
_today:>[entry.DueDate.add(-5184000000)]
```

Explanation:

'DueDate' is the name of a date entered by the user. I want to substract 60 days (5184000000) and then check if the result is smaller than today's date and return True or False.

(Confiforms-Cloud version: 1.2.228-AC).


Tags: addon-com.vertuna.confluence.plugins.confiforms

confiforms

confluence-cloud