Filter based on date and interval


#1

I know I can run the following to test if dates are greater, equal, or less than:

MyType.fetch({ filter: 'myDate < now()' });

But what if I want to see if myDate is within 10 days of now:

MyType.fetch({ filter: '(now() - myDate) > 10' }); I know this doesn’t work but just given an example of what I’m looking for.

There is an internal() expression but I can’t seem to get it to work in a way I would think.


#2

Something like this should work
MyType.fetch({ filter: ' (myDate < now()) && (now() - period(10,'DAY')) < myDate '})


#3

MyType.fetch({ filter: "dateField >= (now() - period(10,'DAY'))" })