B. If such person cannot be conveniently brought before the court, the court may issue an order of temporary detention. The officer executing the order of temporary detention shall order such person to remain confined in his home or another's residence or in some convenient and willing institution or other willing place for a period not to exceed 48 hours prior to a hearing. An electronic device may be used to enforce such detention in the person's home or another's residence. The institution or other place of temporary detention shall not include a jail or other place of confinement for persons charged with criminal offenses. If the specified 48-hour period terminates on a Saturday, Sunday, legal holiday or day on which the court is lawfully closed, such person may be detained until the next day which is not a Saturday, Sunday, legal holiday or day on which the court is lawfully closed.