I have the following code on the server :
'appEndTime': function() {
if(moment().day() == 5 && dayBool){
console.log('first')
dayBool = false
return moment().day(5 + 7).format();
} else if(moment().day() < 5 ){
dayBool = true;
console.log('second')
console.log(moment().day(7 - moment().day()).format())
return moment().day(7 - moment().day()).format();
} else if(moment().day() > 7) {
dayBool = true;
console.log('third')
return moment().day(moment().day() - 7).format();
}
}
the code under else if(moment().day() < 5 ){
get executed and below is what is being printed to the console:
The date is printed successfully in the server, however, when I pass it to the client and try to console.log
the value, I get undefined
printed in the console.
Below is how I am calling it in the client:
var endtime = Meteor.call("appEndTime", function (error, result) {
if(error){
console.log('endTime Error : ' + error)
} else {
console.log('Bingo, it worked!!');
console.log(endtime)
}
});
console.log(endtime)
Below is the result found on the client:
How can I get the value in the client in the same format as it is in the server.