I want to calculate month with days in javascript.
I have requirement like My date range will be within 24 months.
I have todate
comes from somewhere that is 24 Sep 2012
Now,
if I enter 31 Aug 2010 in from date and 24 Sep 2012 in todate
, it shows an error message.
Currently I am doing like that
todate.getMonth() - fromdate.getMonth() + (12 * (todate.getFullYear() - fromdate.getFullYear()))
but, if I enter 23 Sep 2010 in from date and 24 Sep 2012, it should also show error message..
but, its allowing me that date..which is 24 month beyond date..so, how can I calculate month with date which does not allow my above given date.
Thanks