XJS: how to compare dates to check if within 24 hrs

I want to write a small function that takes in 2 date/time parameters in the following format:
flightDate =    2015-05-14T09:30
currentDate = 2015-05-13T19:41

And I want to compare date/time and make sure that flightDate is not within 24hrs of currentDate. if yes, throw error.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RobOwner (Aidellio)Commented:
Use the moment.js framework: http://momentjs.com/docs/#/parsing/

var flightDate =    moment("2015-05-14T09:30");
var currentDate = moment("2015-05-13T19:41");

var d = flightDate.diff(currentDate, "hours");

if (d <= 24) {
badtz7229Author Commented:
I'm getting that "diff" is not a function.
is there a way to implement the diff function for my purposes?
RobOwner (Aidellio)Commented:
Yes because you need to include the moment library.
See this demo http://jsbin.com/xawimujunu/1/edit?js,console,output
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

badtz7229Author Commented:
without importing libraries can this be done?
RobOwner (Aidellio)Commented:
It can but you need to parse the days yourself

What have you done do far?
badtz7229Author Commented:
all I had done was

                          if (flightDate .toString() < currentDate .toString())
                                  bSameDay = true;

but this was only comparing dates. not time.
RobOwner (Aidellio)Commented:
If you're having trouble now it's only going to get harder to parse the dates. A library is just JavaScript, nothing special, you just put this at the top if your page in the head section:

<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script>

And then use their code I've posted previously. With your level of knowledge, I suggest this is the only way for you.

More on JavaScript frameworks http://www.experts-exchange.com/articles/12264/Javascript-Frameworks-what-are-they.html
badtz7229Author Commented:
I didn't end up using any of the suggestions (though good ones).
Instead I built my own function to calculate

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
badtz7229Author Commented:
I created a function to calculate dates. I do not have access to those built in functions in my environment that were suggested
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.