How long can an H4 stay in US after H1B loses job and moves to India

How long can an H4 dependent stay in the US if the primary H1B loses their job and moves back to India? I-94 is valid till 2022. I will need to move out of the country after leaving the current H1B job but can my H4 dependent stay a little longer? How long can they stay back?

H4 cannot stay in the USA without H1B. They should leave on the same day as H1B.