Do you mean the variables should be validated before calling the function? Then simply place the validation in the code before you call your function and set to 7 or 31 if less than those values.