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")) 

jsfiddle


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -