updated date logic