My store has objects representing invoices, with the two following properties:
date The invoice date
datepaid The date the invoice has been paid
datepaid either stores a numeric timestamp, or is null (meaning the invoice is not paid).
I am trying to make a Filter giving me all invoices that:
have been made (i.e. have date) before a given date
have been paid later than the given date, or not paid at all.
This for me translates to:
date < givendate && (datepaid >= givendate || datepaid === null)
In terms of creating the filter I wrote:
new Filter().and(
new Filter().lt("date", givendate.getTime()),
new Filter().or(
new Filter().gte("datepaid", givendate.getTime()),
new Filter().eq("datepaid", null)
)
)
This does not seem to work - among the results, I get also some that have date greater than givendate.
There are no errors in the console.
The filter I get when giving a date of, e.g., May 1st 2017 is:
And in the results I get some invoices that have a date of May 4th 2017 (the timestamp being 1493848800000, which is definitely not less than 1493589600000).
Any suggestions?
My store has objects representing invoices, with the two following properties:
date
The invoice datedatepaid
The date the invoice has been paiddatepaid
either stores a numeric timestamp, or is null (meaning the invoice is not paid).I am trying to make a Filter giving me all invoices that:
date
) before a given dateThis for me translates to:
date < givendate && (datepaid >= givendate || datepaid === null)
In terms of creating the filter I wrote:
This does not seem to work - among the results, I get also some that have
date
greater thangivendate
. There are no errors in the console. The filter I get when giving a date of, e.g., May 1st 2017 is:And in the results I get some invoices that have a
date
of May 4th 2017 (the timestamp being 1493848800000, which is definitely not less than 1493589600000). Any suggestions?