I'm trying to get the first and last date of the current month using Node.js.
Following code is working perfectly in browser (Chrome):
var date = new Date(), y = date.getFullYear(), m = date.getMonth();
var firstDay = new Date(y, m, 1);
var lastDay = new Date(y, m + 1, 0);
console.log(firstDay);
console.log(lastDay);
But it is showing a different result in Node.js. How can I fix it?