1
0
Fork 0
mirror of synced 2024-08-05 05:11:43 +12:00

Down to 66 failures.

This commit is contained in:
Sam Rose 2024-06-13 12:30:36 +01:00
parent f352c5efc1
commit 69ab1ce44f
No known key found for this signature in database

View file

@ -324,9 +324,11 @@ export const runQuery = (
if (docValue == null || docValue === "") { if (docValue == null || docValue === "") {
return false return false
} }
if (testValue.low == null && testValue.high == null) { if (testValue.low == null && testValue.high == null) {
return false return false
} }
if (!isNaN(+docValue)) { if (!isNaN(+docValue)) {
if (!isNaN(+testValue.low) && !isNaN(+testValue.high)) { if (!isNaN(+testValue.low) && !isNaN(+testValue.high)) {
return +docValue >= testValue.low && +docValue <= testValue.high return +docValue >= testValue.low && +docValue <= testValue.high
@ -336,18 +338,32 @@ export const runQuery = (
return +docValue <= testValue.high return +docValue <= testValue.high
} }
} }
if (dayjs(docValue).isValid()) {
if (dayjs(testValue.low).isValid() && dayjs(testValue.high).isValid()) { const docDate = dayjs(docValue)
if (docDate.isValid()) {
const lowDate = dayjs(testValue.low)
const highDate = dayjs(testValue.high)
if (lowDate.isValid() && highDate.isValid()) {
return ( return (
dayjs(docValue).isAfter(testValue.low) && (docDate.isAfter(lowDate) && docDate.isBefore(highDate)) ||
dayjs(docValue).isBefore(testValue.high) docDate.isSame(lowDate) ||
docDate.isSame(highDate)
) )
} else if (dayjs(testValue.low).isValid()) { } else if (lowDate.isValid()) {
return dayjs(docValue).isAfter(testValue.low) return docDate.isAfter(lowDate) || docDate.isSame(lowDate)
} else if (dayjs(testValue.high).isValid()) { } else if (highDate.isValid()) {
return dayjs(docValue).isBefore(testValue.high) return docDate.isBefore(highDate) || docDate.isSame(highDate)
} }
} }
if (testValue.low && testValue.high) {
return docValue >= testValue.low && docValue <= testValue.high
} else if (testValue.low) {
return docValue >= testValue.low
} else if (testValue.high) {
return docValue <= testValue.high
}
return false return false
} }
) )