Comparing dates in mongoose seems to be failing for me. My Date comparison always returns false even if I set the date to far in the future.
TaskSchema = new Schema({
description: String,
end: { type: Date, required: true, index:true}
})
task.end >= Date()
Not sure I exactly understand the answer but the following works if I new an instance of the Date instead of just calling Date()
I thought Date() was a static factory method that creates a date object, but I guess I could be wrong. If I console.log Date() and new Date(), they both print out dates, so not sure what the difference is, but regardless it works if I new the Date.