
71 Cal.Rptr.3d 462 (2008)
159 Cal.App.4th 301
The PEOPLE, Petitioner,
v.
The SUPERIOR COURT of San Diego County, Respondent.
Charles Small, Real Party in Interest.
No. D051355.
Court of Appeal of California, Fourth District, Division One.
January 24, 2008.
*464 Bonnie M. Dumanis, District Attorney, Catherine A. Stephenson, Craig E. Fisher, Terrie Roberts and Stephen E. Carr, Deputy District Attorneys for Petitioner.
No appearance for Respondent.
Steven J. Carroll, Public Defender, Michael Ruiz, Laura Arnold, Deputy Public Defenders for Real Party in Interest.
McINTYRE, J.
Charles Small was scheduled to be released from prison on a Sunday, but the Department of Corrections kept him in custody so that the People could file a petition to civilly commit him as a sexually violent predator (SVP) under the Sexually Violent Predators Act (the Act, Welf. & Inst.Code, § 6600 et seq.) the following Monday. (All undesignated statutory references are to the Welfare and Institutions Code.) The issue presented is whether the trial court properly dismissed the petition to commit Small under the Act.
We conclude that the trial court properly dismissed the petition because Small was in unlawful custody, the People failed to show that its delay in filing the petition resulted from a good faith mistake of fact or law (§ 6601, subd. (a)(2)) and Code of Civil Procedure section 12a did not extend the time to file the petition.

FACTUAL AND PROCEDURAL BACKGROUND
In 1999, Small was convicted of committing a lewd act upon a nine-year-old child and sentenced to prison for six years. On January 5, 2007, the Department of Mental Health (Mental Health) received a referral requesting that Small be evaluated under the Act. (All further dates are in 2007.) Small was scheduled to be paroled on February 6, but the day before his release the Board of Parole Hearings placed a 45-day hold on him to conduct the SVP evaluation. (§ 6601.3.) (Eff. July 1, 2005, the Board of Parole Hearings replaced the Board of Prison Terms. (Pen.Code, §§ 5075, 5075.1; Gov.Code, § 12838.4.).)
On March 20, Mental Health learned that the doctor initially scheduled to evaluate Small could not perform the evaluation. Two doctors evaluated Small on March 21 and 22, but arrived at differing conclusions about whether he met the SVP criteria. Because the initial evaluators disagreed, Mental Health was required to arrange for further evaluation by two additional doctors. (§ 6601, subd. (e).) Although the 45day hold period expired on Friday March 23, the Department of Corrections delayed Small's release until Sunday March 25 under subdivision (e) of Penal Code section 3060.7, which allowed it to delay the scheduled parole release by two days because the scheduled release date fell on the day before a weekend. On Saturday March 24, two doctors evaluated Small and both concluded that he met the SVP criteria. (§ 6601, subds.(f) & (g).) Mental Health immediately faxed the evaluations to the district attorney's office and the district attorney filed an SVP petition the next business day, Monday March 26, which was one day after Small was to be released on parole.
On April 6, the trial court arraigned Small and set the matter for a probable cause hearing. On July 3, the trial court found probable cause to believe that Small suffered from a mental disorder and was a danger to others and set the matter for trial. On July 10, Small filed a motion to dismiss the petition claiming that the trial court lacked jurisdiction. Specifically, Small asserted that he was in unlawful custody when the district attorney filed the petition on March 26 because the 45-day parole hold period had expired.
*465 In response to the motion, Mental Health explained that due to the passage of Jessica's law in 2006 (see Historical and Statutory Notes, 73D West's Ann. Welf. & Inst.Code (2007 supp.) foil. § 6604, pp. 125, 131; Prop. 83, § 27, approved Nov. 7, 2006, eff. Nov. 8, 2006), the mental health professionals at Mental Health have gone from performing an average of 50 SVP evaluations a month to an average of over 700; accordingly, Mental Health prioritizes the evaluations based on the inmate's release date. It argued that the petition should not be dismissed because the one day filing delay occurred in good faith and was not the result of negligence and that Small had not been prejudiced by the delay.
After hearing argument on the motion, the trial court noted that subdivision (a)(2) of section 6601 required that an SVP petition be filed while an individual is in "lawful custody," but that a petition, should not be dismissed if the unlawful custody was the result of a "good faith mistake of fact or law." The trial court concluded that Small was in lawful custody until Sunday March 25 and that the district attorney undisputedly did not file the petition until the following day. It found that the unambiguous statutory language should be given mandatory effect and that it had to dismiss the SVP petition if the unlawful custody was not the result of a good faith mistake of fact or law. It also found that the failure of Mental Health to timely complete the necessary evaluations was not the result of a good faith factual or legal mistake and granted the motion to dismiss, staying its order to allow the People to petition this court.
The People sought writ review of the trial court's order, requesting that the order be vacated and a new and different order be entered denying the motion. We stayed the matter pending further order of this court and issued an order to show cause why the relief sought should not be granted.

DISCUSSION
Small contends that the trial court properly dismissed the petition because he was unlawfully in custody when the district attorney's office filed the commitment petition, his unlawful custody was not the result of a good faith mistake of law or fact, and thus his unlawful custody divested the court of jurisdiction to decide the petition. As discussed below, substantial evidence supported the trial court's findings that Small was unlawfully in custody when the People filed the commitment petition and that his unlawful custody was not the result of a good faith mistake of law or fact. We disagree that the trial court lost jurisdiction in the fundamental sense; we do conclude, however, that in the absence of a good faith mistake of law or fact, that the petition must nonetheless be dismissed and any other subsequent actions by the court on the petition are invalid.
Under the Act, the Department of Corrections must refer an inmate for SVP evaluation at least six months before the inmate's release date (§ 6601, subd. (a)) and if the inmate's parole date will be reached before the evaluation is complete, the Board of Parole Hearings can hold the inmate for 45 days beyond that release date. (§ 6601.3.) When enacted, the Act contained no explicit requirement that a defendant's custody be lawful; it required only that the alleged SVP be "in custody under the jurisdiction of the Department of Corrections[.]" (§ 6601, subd. (a), as enacted, Stats.1995, ch. 763, § 3.) A number of appellate courts have interpreted this language and rejected the argument that lawful custody was a jurisdictional prerequisite to the filing of a petition under the Act. In other words, the unlawfulness *466 of the defendant's custodial status did not divest the trial court of jurisdiction to proceed on a petition for commitment or recommitment. (People v. Hedge (1999) 72 Cal.App.4th 1466, 1478-1479, 86 Cal. Rptr.2d 52; People v. Superior Court (Whitley) (1999) 68 Cal.App.4th 1383, 1389-1390, 81 Cal.Rptr.2d 189 (Whitley II); Garcetti v. Superior Court (1998) 68 Cal.App.4th 1105, 1117-1118, 80 Cal. Rptr.2d 724.)
The Legislature subsequently amended section 6601 to provide as follows: "A petition shall not be dismissed on the basis of a later judicial or administrative determination that the individual's custody was unlawful, if the unlawful custody was the result of a good faith mistake of fact or law." (§ 6601, subd. (a)(2), italics added.) The Legislature added this language in response to the problem presented by Terhune v. Superior Court (1998) 65 Cal. App.4th 864, 76 Cal.Rptr.2d 841 (Whitley I) and Whitley II, supra, 68 Cal.App.4th 1383, 81 Cal.Rptr.2d 189. (Sen. Com. on Public Safety, Bill Analysis of Sen. Bill No. 11 (1999-2000 Reg. Sess.) as introduced Dec. 7, 1998, pp. 2-3.) In Whitley I, the Court of Appeal barred SVP proceedings against an inmate because the Board of Parole Hearings and the Department of Corrections had improperly revoked the inmate's parole prior to his release from prison. (Whitley I, supra, 65 Cal.App.4th at p. 880, 76 Cal.Rptr.2d 841.) After the district attorney again filed a petition for the inmate's commitment under the Act, the court reversed its decision in Whitley I, holding that the SVP petition could proceed because the Board of Parole Hearings and the Department of Corrections did not unlawfully hold the inmate in custody through "negligent or intentional wrongdoing." (Whitley II, supra, 68 Cal. App.4th at p. 1390, 81 Cal.Rptr.2d 189.)
The Legislature included a statement that the amendment was "declaratory of existing law" and did not intend that a person be released based upon a subsequent finding that "all or part of a determinate prison sentence, parole revocation term, or a hold placed pursuant to Section 6601.3, ... was unlawful." (Stats.1999, ch. 136, § 3.) This amendment makes it "absolutely clear" that "lawful custody has never been a jurisdictional prerequisite to filing an SVP petition." (People v. Wakefield (2000) 81 Cal.App.4th 893, 898, 97 Cal. Rptr.2d 221.) Accordingly, we reject Small's assertion that a court lacks jurisdiction to decide an SVP petition filed after the 45-day hold period.
This conclusion, however, does not end our inquiry because the district attorney filed the petition more than 45 days beyond Small's scheduled release date and we must decide the consequence for the untimely petition. As our high court recently explained, a governmental violation of a mandatory statutory requirement does not necessarily mean a court loses fundamental jurisdiction over the subject matter or the parties. (People v. Allen (2007) 42 Cal.4th 91, 101, 64 Cal. Rptr.3d 124, 164 P.3d 557, fh. 5 (Allen).) Rather, if a particular procedural requirement is deemed "mandatory," then noncompliance with the procedural requirement invalidates the governmental action taken in violation of the procedural requirement. (Id. at p. 101, 64 Cal.Rptr.3d 124, 164 P.3d 557.) In contrast, if a procedural requirement is deemed "directory," then noncompliance with the procedural requirement will not invalidate the governmental action. (Ibid.)
Whether a particular statute is intended to impose a mandatory duty, rather than a mere obligation to perform a discretionary function, is a question of statutory interpretation for the courts. (Allen, supra, 42 Cal.4th at p. 101, 64 *467 Cal.Rptr.3d 124, 164 P.3d 557.) There is no mechanical test for determining whether a provision should be given mandatory or directory effect and we must ascertain the legislative intent "`from the terms of the statute construed as a whole, from the nature and character of the act to be done, and from the consequences which would follow the doing or failure to do the particular act at the required time.'" (Id. at pp. 101-102, 64 Cal.Rptr.3d 124, 164 P.3d 557, quoting Pulcifer v. County of Alameda (1946) 29 Cal.2d 258, 262, 175 P.2d 1.)
In Allen, our high court interpreted a provision of the Mentally Disordered Offenders Act (MDO Act, Pen.Code, § 2960 et seq.), which states: "Prior to the termination of a commitment under this section, a petition for recommitment may be filed to determine whether the patient's severe mental disorder is not in remission or cannot be kept in remission without treatment, and whether by reason of his or her severe mental disorder, the patient represents a substantial danger of physical harm to others." (Pen.Code, § 2972, subd. (e), italics added.) The court noted that the MDO Act did not set a deadline for the completion of trial; rather, it set an "absolute deadline to begin the recommitment processthe termination of the current one-year commitment." (Allen, supra, 42 Cal.4th at p. 104, 64 Cal.Rptr.3d 124, 164 P.3d 557.) Although the statute did not expressly provide for any type of sanction, such as dismissal, for untimely recommitment petitions, the court concluded that the plain language of the statute together with other provisions of the MDO Act reflected a legislative intent "to prohibit the filing of a petition, and the initiation of commitment proceedings, after a parole period or previous commitment has expired." (Allen, supra, 42 Cal.4th at pp. 100,104, 64 Cal.Rptr.3d 124, 164 P.3d 557.)
The court rejected the argument that an inmate suffers no actual prejudice based on a late filed recommitment petition, commenting that it would be futile to determine whether a delayed petition violated an inmate's due process rights. (Allen, supra, 42 Cal.4th at p. 105, 64 Cal.Rptr.3d 124, 164 P.3d 557.) The court noted that the MDO Act did not provide for a waiver or good cause exception and urged the Legislature to recognize that good cause may exist for an untimely filed recommitment petition and specifically address the consequences of such petitions. (Id. at pp. 100, 108, 64 Cal.Rptr.3d 124, 164 P.3d 557.) In the interim, the court suggested that the Lanterman-Petris-Short Act (the LPS Act, § 5000 et seq.) might authorize the custodial treatment of an inmate's mental disorder. (Allen, supra, 42 Cal.4th at p. 108, 64 Cal.Rptr.3d 124, 164 P.3d 557.)
Here, the Act analogously sets no limit on the time in which trial of an SVP petition must be commenced or concluded (People v. Superior Court (Ramirez) (1999) 70 Cal.App.4th 1384, 1389, 83 Cal. Rptr.2d 402), but it expressly provides that the Board of Parole Hearings may order that a person referred to Mental Health for evaluation "remain in custody for no more than 45 days beyond the person's scheduled release date" (§ 6601.3, italics added), that a petition must be filed against a person "in custody" and the petition should not be dismissed if it is later found that the person was in unlawful custody because of "a good faith mistake of fact or law." (§ .6601, subd. (a)(2).) One court has commented that this statutory language necessarily implies that a commitment or recommitment petition should be dismissed if the unlawful custody was not the result of a good faith mistake of fact or law. (People v. Badura (2002) 95 Cal.App.4th 1218, 1224, 116 Cal.Rptr.2d 336.) We agree.
The Legislature contemplated that "at least six months" before the scheduled release of an inmate, the Department *468 of Corrections would refer the inmate for an SVP evaluation. (§ 6601, subd. (a)(1).) Recognizing that there might be a late referral of an inmate, the Legislature authorized the Board of Parole Hearings to hold an inmate for a maximum of 45 days beyond a scheduled release date to conduct the necessary evaluations. (§ 6601.3.) The Legislature then codified an exception to the 45-day time period, noting that a petition should not be dismissed if a person is in unlawful custody as a result of a good faith mistake of law or fact. (§ 6601, subd. (a)(2).) Construing the Act as a whole suggests that the 45-day time frame denotes the lawful custody period. Where, as here, an inmate is held beyond the 45-day period, the custody becomes unlawful and the petition must be dismissed unless the unlawful custody resulted from a good faith mistake of fact or law.
In a footnote Small contends that his custody became unlawful on Friday March 23 and that the Department of Corrections improperly used Penal Code section 3060.7 to delay his parole release to the following Sunday. We do not need to address the issue because it does not matter whether Small's custody became unlawful on Friday or Sunday as it is undisputed that the petition was not filed until Monday and Small was in unlawful custody on that day.
Accordingly, the question becomes whether Small's unlawful custody resulted from a good faith mistake of law or fact. The trial court found that the unlawfulness of Small's custody resulted from a delay on the part of Mental Health and not from either a legal or factual mistake. Notably, the People did not challenge this finding and our review of the record does not show any error in this regard. Rather, the Department of Corrections waited until a month before Small's release date to refer him to Mental Health for evaluation and Mental Health did not begin the evaluation process until near the end of Small's 45day hold period.
Although the People presented evidence showing that the passage of Jessica's law in 2006 greatly increased the number of referrals to Mental Health (721 referrals in January, 740 in February and 673 in March), it did not explain the initial delay in referring Small to Mental Health for evaluation or the delay in obtaining' the evaluations (i.e., the number of inmates with earlier release dates than Small). The increased workload does not amount to a mistake of law or fact and is something that the Department of Corrections and Mental Health could have anticipated and prepared for.
In a final effort to avoid dismissal of the petition, the People contend that since the last day to file the petition fell on a Sunday, Code of Civil Procedure section 12a extended the time period to file the petition to the next business day. Subdivision (a) of Code of Civil Procedure section 12a provides that "[i]f the last day for the performance of any act provided or required by law to be performed within a specified period of time is a holiday," then the period is extended to include the next day that is not a holiday. For this purpose, "holiday" means every Sunday. (Code Civ. Proa, §§ 10, 135; Gov.Code, § 6700, subd. (a).)
Code of Civil Procedure section 12a does not assist the People because section 6601.3 does not provide the last day for the performance of an act, i.e., the filing of an SVP petition; rather, it sets forth a maximum time period in which the Board of Parole Terms can lawfully hold an inmate beyond the person's release date. After the 45-day period, an inmate's custody becomes unlawful and a petition filed after that time period must be dismissed unless a legal or factual mistake is shown. The People have cited no authority supporting use of Code of Civil Procedure section 12a *469 to extend a person's period of incarceration and we have found none.
Although our conclusion prevents Small's involuntary civil commitment under the Act, he may be subject to the civil commitment procedures of the LPS Act if he is in need of custodial treatment and we presume that responsible parties will explore this option. (Allen, supra, 42 Cal.4th at p. 108, 64 Cal.Rptr.3d 124, 164 P.3d 557.)

DISPOSITION
The petition is denied and the stay issued on August 3, 2007 is vacated. This opinion is final as to this court 15 days after it is filed. (See Cal. Rules of Court, rule 8.264(b)(3).)
WE CONCUR: HALLER, Acting P.J., and O'ROURKE, J.
