Date formating issue with internet explorer

ksd123 used Ask the Experts™
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
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Manager / Solutions Architect
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


Thank you.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial