In a cloud function like the following, I am having problems comparing dates:
Parse.Cloud.define(“myCloudFunction”, function(request, response)
{
var query = new Parse.Query(“MyClass”);
query.find
({
success: function(resultList) {
var today = new Date();
for (var i = 0; i < resultList.length; ++i) {
if (resultList[i].get(“dateFieldOne”)>resultList[i].get(“dateFieldTwo”)) {
// Do something!!
} else {
// Do some other thing!!
if (resultList[i].get(“dateFieldOne”)>today) doOneMoreThing();
}
}
response.success(resultList);
},
error: function() {
response.error("Things have gone wrong.”);
}
});
});
The lines :
if (resultList[i].get(“dateFieldOne”)>resultList[i].get(“dateFieldTwo”))
if (resultList[i].get(“dateFieldOne”)>today) doOneMoreThing();
are not working.
What is the syntax I am supposed to use in this context, to compare the two fields dateFieldOne and dateFieldTwo of type Date?