Monday, April 11, 2016

Setting Dateprompt to Previous WorkingDay

  • Add DatePrompt
  • Enter a valid name in the name propety of the prompt. f.e: StartDate 
  • Add a HTML block to ritght of the prompt
  • Enter the following JavaScript block
  • <script language="javascript">
         var dDate = new Date();
         //Subtract one day
         dDate.setDate(dDate.getDate()-1);
                           if (dDate.getDay() ==0) {
            dDate.setDate(dDate.getDate() -2);
        }
          if (dDate.getDay() ==6) {
            dDate.setDate(dDate.getDate() -1);
        }
         pickerControlStartDate.setValue(getFormatDate(dDate, 0 , 'YMD'));
     </script>
  • If your prompt has different name change the bold part in the script

  •  
Till Next Time

No comments: