replace date logic