update date gap algorithm