It’s not an exact science, but generally when the person stops eating or drinking, the end is near. My mother was given two weeks when her cancer metastasized to her abdominal cavity and developed ascites - it was about 10 days later when she passed. The last 24 hours it was clear she was actively dying. If an experienced hospice provider indicates death is near, they are probably right - though there will always be exceptions.