method function:
function FormatDate (strTime) { var date = new Date(strTime); return date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate(); }
Call method:
var today = new Date(); var today_time = FormatDate(today); if(today_time>'2018-4-25'){ alert( 'Activity has ended' ); return false ; }