(a)
Whenever a minor is taken into custody by a peace officer or probation officer, except when such minor willfully misrepresents himself as 18 or more years of age, such minor shall be released within 48 hours after having been taken into custody, excluding nonjudicial days, unless within said period of time a petition to declare him a dependent child has been filed pursuant to the provisions of this chapter.
(b)
Whenever a minor who has been held in custody for more than six hours by the probation officer is subsequently released and no petition is filed, the probation officer shall prepare a written explanation of why the minor was held in custody for more than six hours. The written explanation shall be prepared within 72 hours after the minor is released from custody and filed in the record of the case. A copy of the written explanation shall be sent to the parents, guardian, or other person having care or custody of the minor.