javascript - How to enable last 3 months date from current date in DHTML v1.0 -
if(date.getfullyear() == now.getfullyear()) { if(date.getmonth() < now.getmonth() - 3) { return true; // disable other dates } if(date.getmonth() == now.getmonth() - 3) { if(date.getdate() < now.getdate()) { return true; } } }
this code working fine.but if current date in february. not disabling december since included in 3 months. please share opinion on this.
var threemonthsago = new date(); threemonthsago.setmonth(threemonthsago.getmonth() - 3); return threemonthsago <= date
Comments
Post a Comment