Hi Everyone!

I need to display a file upload section only if the deadline has not been reached.

Deadline is stored in:

 #form.assessments.deadline[{requestParam.assessmentid}]#

Is something like this possible in Beanshell Permission and how would I do it?:

if(today > deadline){
     return false;
}else{
     return true;
}

1 Comment

  1. I got it working by using the following.  (If there is a better way please let me know.)

     import java.util.Date;
    import java.text.*;
    
    Date deadline = new Date( );
          SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
          String deadlineInString = "#form.assessments.deadlinerev1[{requestParam.assessmentid}]#";
          String todayInString = "#date.yyyy-MM-dd#";
    
          Date deadline = formatter.parse(deadlineInString);
          Date today = formatter.parse(todayInString);
    
    if(today.after(deadline)){
        return false;
    }else{
         return true;
    }