Define Timer Expression with start date, end date and interval

I am trying to send a reminder email. The email is triggered using the Timer Bound Event. The following expression is working for me R5/${dateTime().withMillis(lastDay).minusDays(5)}/P1D. What i am trying to achieve is, like R/<start_date>/<interval>/<end_date>. The reason why I cannot use the above expression is that if the lastDay has passed the current date then the engine returns an error as ‘Due Date cannot be null’. I would like to know if there any possible way of achieving this.

I used the reference able at - ISO 8601 - Wikipedia. If anyone can guide, it would be great help.