Date formating issue with internet explorer

Hi Experts,

We are using moment.js for parsing/formatting date in our application , my requirement is the user should not enter date greater than current month  + 6 months.I have working code  in fiddler Date fomat for chrome browser but  the same code is not working for  internet explorer 11 and firefox browsers.The date format we  are using is MM/DD/YYYY. If we run the fiddler in chrome you get message "The date cannot be greater than 08/01/2016" so I want same output in internet explorer and firefox browser's .Try to run fiddler in these browsers you  get meessage "The date cannot be greater than Invalid Date" (instead of actual date ie.08/01/2016).


Thanks in Advance
ksd123Asked:
Who is Participating?
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.

Alexandre SimõesManager / Solutions ArchitectCommented:
Why are you formatting back and forth?

Wouldn't this simply work?
var dt=(moment([moment().year(), moment().month()]).add(6, 'months'))
alert("The date cannot be greater than "+ dt.format('L'));

Open in new window

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
ksd123Author Commented:
Thank you.
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
Angular

From novice to tech pro — start learning today.