updated updateBalance function with update for past date and future date