added past date logic