(a) If a child is in detention prior to adjudication, a petition alleging delinquency shall be filed not later than 72 hours after the detention hearing. If no petition alleging delinquency is filed within the applicable time, such child shall be released from detention and the complaint shall be dismissed without prejudice. Such petition may be refiled as provided in subsection (b) of this Code section within the statute of limitations.
(b) If a child is not in detention prior to adjudication, a petition alleging delinquency shall be filed within 30 days of the filing of the complaint alleging violation of a criminal law or within 30 days of such child's release pursuant to a determination that detention is not warranted. Upon a showing of good cause and notice to all parties, the court may grant an extension of time for filing a petition alleging delinquency. The court shall issue a written order reciting the facts justifying any extension.