added some date logic