(f) A temporary restraining order issued under this section shall remain in effect, at the court's discretion, for a period not to exceed 21 days, or, if the court extends the time for hearing under subdivision (g), not to exceed 25 days, unless otherwise modified or terminated by the court.
(g) Within 21 days, or, if good cause appears to the court, 25 days from the date that a petition for a temporary order is granted or denied, a hearing shall be held on the petition. If a request for a temporary order is not made, the hearing shall be held within 21 days, or, if good cause appears to the court, 25 days, from the date that the petition is filed.