
841 So.2d 657 (2003)
C.C., a Child, Appellant,
v.
STATE of Florida, Appellee.
No. 4D02-828.
District Court of Appeal of Florida, Fourth District.
April 9, 2003.
*658 Carey Haughwout, Public Defender, and Anthony Calvello, Assistant Public Defender, West Palm Beach, for appellant.
Charles J. Crist, Jr., Attorney General, Tallahassee, and August A. Bonavita, Assistant Attorney General, West Palm Beach, for appellee.
MAY, J.
The defendant appeals the trial court's order, which committed her to a moderate risk program for an indeterminate period not to exceed one year or the child's nineteenth birthday, as a result of a violation of probation. She argues that the trial court erred in failing to give her credit for time served in the juvenile detention center. The State concedes she is entitled to credit for time served in secure detention, but argues that she was ordered into respite care for which she is not entitled to credit. We reverse and remand the case to the trial court for calculation of the number of days spent in secure detention to be credited against the length of time the juvenile is committed. L.K. v. State, 729 So.2d 1011 (Fla. 4th DCA 1999). In doing so, however, we make the following observation.
The authorization for giving an adult defendant credit for time served is legislative in origin. See § 921.161(1), Fla. Stat. (2003). No such provision exists in Chapter 985 or in the Florida Rules of Juvenile Procedure. In other words, giving juveniles credit for time served in secure detention was born of judicial interpretation.
In Tal-Mason v. State 515 So.2d 738 (Fla.1987), the Florida Supreme Court reviewed the issue of "credit for time served" in the context of whether time spent in a mental institution as a result of an involuntary commitment for incompetency should be credited against an adult prison sentence. The Supreme Court held that it should.
[W]e hold that there is no legitimate basis for granting jail-time credit for preconviction detention in a hospital for treatment of physical injuries, but not for preconviction detention in a mental institution for incompetence to stand trial. Both of these forms of detention constitute a coercive deprivation of liberty and implicate significant constitutional rights. When a defendant is committed for incompetence, the state has assumed total, if constructive, custody of that defendant as though he were in the county jail. To grant no jail-time credit for this kind of detention while allowing it for others constitutes a violation of equal protection and a denial of due process.
Id. at 740.
The Second District Court of Appeal relied upon this reasoning in E.R. v. State, 584 So.2d 158 (Fla. 2d DCA 1991), when it held that juveniles are entitled to credit for time spent in secure detention. Our court has since followed that lead. See L.K., 729 So.2d at 1011; J.B. v. State, 829 So.2d 376 (Fla. 4th DCA 2002).
However, it is only where a determinate length of commitment exists that such credit can be given any real meaning. This will occur in juvenile misdemeanor cases only where the maximum period of commitment is limited to a year and when the juvenile is committed within one year of reaching the age of nineteen (19).
The juvenile justice system is designed to rehabilitate youth. Accordingly, juveniles are committed for indeterminate lengths of time. It is, therefore, generally impossible to fix a date from which to deduct time spent in secure detention. Perhaps this is why there is no comparable statute found in Chapter 985. Nevertheless, *659 this is one of those cases involving a misdemeanor where the credit for time served in secure detention can find certainty.
We therefore reverse and remand the case to the trial court for calculation of time served in secure detention to be credited against the one-year commitment.
STEVENSON and GROSS, JJ., concur.
