rem: var completedDate = ensureDateTime(completedDate); 
add: completedDate = ensureDateTime(completedDate); 
context: function checkIfInRange(item, rangeStart, rangeEnd, returnDtstartOrDue){    var startDate;    var endDate;    if (isEvent(item)) {        startDate = item.startDate;        if (!startDate) { // DTSTART mandatory            // xxx todo: should we assert this case?            return null;        }        endDate = (item.endDate || startDate);    } else {        var dueDate = item.dueDate;        startDate = (item.entryDate || dueDate);        if (!startDate) {            if (returnDtstartOrDue) { // DTSTART or DUE mandatory                return null;            }            // 3.6.2. To-do Component            // A "VTODO" calendar component without the "DTSTART" and "DUE" (or            // "DURATION") properties specifies a to-do that will be associated            // with each successive calendar date, until it is completed.            var completedDate = item.completedDate;            if (completedDate) {                var queryStart = ensureDateTime(rangeStart);                var completedDate = ensureDateTime(completedDate);                return (!queryStart || completedDate.compare(queryStart) > 0);            }            return true;        }        endDate = (dueDate || startDate);    }    var start = ensureDateTime(startDate);    var end = ensureDateTime(endDate);    var queryStart = ensureDateTime(rangeStart);    var queryEnd = ensureDateTime(rangeEnd);    if (start.compare(end) == 0) {        if (!queryStart || start.compare(queryStart) >= 0 &&            (!queryEnd || start.compare(queryEnd) < 0)) {            return startDate;        }    } else {        if (!queryEnd || start.compare(queryEnd) < 0 &&            (!queryStart || end.compare(queryStart) > 0)) {            return startDate;        }    }    return null;}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/9421/06b9dd863b83841a18dce5a3b0a4fb969bd930a0/calUtils.js/buggy/calendar/base/src/calUtils.js