adopted-ember-addons / ember-moment

MIT License
399 stars 122 forks source link

isSameOrAfter Returning False when It Should Be True #272

Open jrock2004 opened 6 years ago

jrock2004 commented 6 years ago

So I am trying to do the following to compare 2 dates, but its returning false when it should be true. Here is what my code looks like

let moment = self.get('moment');
let apptTime = moment.moment(appointment.get('startDateTime'));
let currentTime = moment.moment().tz('PST');

console.log(`API Time Returned: ${appointment.get('startDateTime')}`)
console.log(`Current Time: ${currentTime.format('MM/DD h:mm a')}`);
console.log(`Appt Time: ${apptTime.format('MM/DD h:mm a')}`);

return apptTime.isSameOrAfter(currentTime);

Here is what is in my console log

API Time Returned: /Date(1517322900000-0500)/
Current Time: 01/30 8:16 am
Appt Time: 01/30 9:35 am

So what am I missing? Thanks

jasonmit commented 6 years ago

Unsure to be honest, you're invoking momentjs directly and therefore ember-moment isn't involved.