In the end I used SQL filters to reduce the records to only a couple of hundreds and used "for loops" on those. Using DateDiff with months made the most sense for what I needed. The script might not be the most elegant, let me know if there is a simpler way to do this:
var pairs = []
for (var r in rec) {
var keys = r["Equipment"];
var values = r["Date"];
var keyvalue = {"key": keys, "value": values}
Push(pairs, keyvalue)
}
var resultArray = [];
for (var i = 0; i < Count(pairs)-1; i++) {
var current = pairs[i];
var next = pairs[i + 1];
if (Equals(current.key, next.key) && Abs(DateDiff(Date(current.value),Date(next.value), "months")) <= 1) {
Push(resultArray, current.key);
}
}
resultArray