Before change date function