When in the judgment of the department of children, youth, and families the welfare of any person committed to or confined in any state juvenile correctional institution or facility necessitates that the person be transferred or moved for observation, diagnosis, or treatment to an evaluation and treatment facility, the secretary of children, youth, and families or the secretary's designee is authorized to order and effect such move or transfer for a period of up to fourteen days, provided that the secretary notifies the original committing court of the transfer and the evaluation and treatment facility is in agreement with the transfer. No person committed to or confined in any state juvenile correctional institution or facility may be transferred to an evaluation and treatment facility for more than fourteen days unless that person has been admitted as a voluntary patient or committed for one hundred eighty-day treatment under this chapter or ninety-day treatment under chapter
71.05 RCW if eighteen years of age or older. Underlying jurisdiction of minors transferred or committed under this section remains with the state correctional institution. A voluntary admitted minor or minors committed under this section and no longer meeting the criteria for one hundred eighty-day commitment shall be returned to the state correctional institution to serve the remaining time of the underlying dispositional order or sentence. The time spent by the minor at the evaluation and treatment facility shall be credited towards the minor's juvenile court sentence.