Cal. Welf. & Inst. Code § 5264
(b) Any person who has been certified for 14 days of intensive treatment under this article and to whom Section 5226.1 is not applicable, or with respect to whom the criminal charge has been dismissed under Section 5226.1, shall be released at the end of the 14 days unless any of the following applies: