change switch case with ifs + compare with "to" estimate date instead of "from"