Q:

MomentJS isAfter doesn't work when including days

I am trying to use MomentJS to compare two dates. This is the code I'm using:
var returnTime = moment(fetchedReturnTime).utc().format('YYYY-MM-DD HH:mm');
var timeThreeDays = moment().add(3, 'days').utc().format("YYYY-MM-DD HH:mm");
var beginningTime = moment('8:45am', 'h:mma');
var endTime = moment('9:00am', 'h:mma');
console.log(timeThreeDays.isAfter(returnTime)); // true

When I use isAfter with beginningTime and endTime, the comparsion works, but when I use it with returnTime and timeThreeDays I get the error that timeThreeDays.isAfter is not a function. Why could this be happening?

A:

That'll be down to a type mismatch. 
Your returnTime and timeThreeDays variables will be string types, your other variables are moment objects. Moment being a wrapper around the Date object.
If you want to compare these, remove the format method call first.

