The below function gives me the next business date:
function nextBusinessDate() {
var today = moment();
var tomorrow = today.add(1, 'days');
// if saturday
if (tomorrow.day() === 6) {
tomorrow = tomorrow.add(2, 'days');
} else if (tomorrow.day() === 0) {
tomorrow = tomorrow.add(1, 'days');
}
return new Date(tomorrow._d);
}
The date that it returns looks something like this:
myDate = nextBusinessDate();
// This is what myDate looks like in developer console
myDate: Fri Jun 19 2015 07:24:40 GMT-0400 (EDT)
__proto__: Invalid Date
The issue I am facing is that this wont get stored in firebase (which uses mongo I believe)
What am I missing here ?