How to check if a Month/Year is greater than current Month/Year in Javascript -
i want check if 08/2014 greater 02/2014..
how can in javascript?? me please...
currently check future year. here code snippet.
this.isdategreaterthancurrent=function(b){ return parseint(b)>parseint(new date().getfullyear()); };
date
objects can compared each other. instead of parsing them can date
object itself.
function isdategreaterthantoday(b) { var ds = b.split("/"); var d1 = new date(ds[1], (+ds[0] - 1)); var today = new date(); if (d1 > today) { return "d greater"; } else { return "today greater"; } } console.log(isdategreaterthantoday("08/2014"))
Comments
Post a Comment