Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isSameOrAfter Returning False when It Should Be True #272

Open
jrock2004 opened this issue Jan 30, 2018 · 1 comment
Open

isSameOrAfter Returning False when It Should Be True #272

jrock2004 opened this issue Jan 30, 2018 · 1 comment

Comments

@jrock2004
Copy link

jrock2004 commented Jan 30, 2018

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
Copy link
Collaborator

jasonmit commented Feb 3, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants