Typically, you want to avoid even water some time before going to sleep, such that you won’t wake up to go to the bathroom.