When comparing dates, I need to take into account my local Timezone (Asia/Kolkata GMT+5.30).
var today = moment().toDate();
var tomorrow = moment().add(1,'days').toDate();
Moment : I am utilizing MomentJS for this task (but unsure if it's the right tool).
Deal.find({date:{$gte: today, $lt: tomorrow}},function(err, result){
if(err) return console.log("Error" + err);
//Code goes here.
});
The date in the
Deal.find({date:{$gte: today, $lt: tomorrow}},function(err, result){
is based on GMT, while today and tomorrow are in my LOCAL Timezone as mentioned earlier.
How can I handle this? My focus is solely on my local Timezone and I'm not concerned about whether it's UTC or GMT.
I am working with a standard Express4, MongoDB, Mongoose ODM stack.
Is there a method to preprocess and adjust the date variable to my local Timezone before passing it to the Deal.find mongoose query?