Appellant appealed from an order extending his NGI commitment for an additional two years under Penal Code section 1026.5. Appellant was scheduled to be released from the psychiatric institution in November, 2004, and his doctor requested that the prosecutor file a petition to extend the petition. The prosecutor did not file the petition until less than two weeks prior to the scheduled release date, which was after the statutory deadline. The appellate court reversed the denial of appellant’s motion to dismiss the petition. The statutory deadlines require that a defendant be given time to prepare for trial before his term of commitment expires. Here, appellant was given less than two weeks to prepare for trial before expiration of his commitment. The prejudice to appellant outweighed the prosecutor’s reason for the delay (a clerical error.) Counsel would have been unable to adequately prepare for a trial, obtain the assistance of experts, or review the volumes of medical records. Appellant’s due process rights were violated and his motion to dismiss the petition should have been granted.