You're mixing up two things.
One thing is the sacrificial protection charm put in place by Lily Evans, which has no defined canon duration and theoretically could last indefinitely.
I am speaking, of course, of the fact that your mother died to save
you. She gave you a lingering protection
Rowling, J.K.. Harry Potter and the Order of the Phoenix (p. 769).
Pottermore Publishing. Edición de Kindle.
And another entirely thing is the charm put in place by Dumbledore to protect Harry while he was with his family in Privet Drive. This charm uses the blood bond that Harry, Lily and Petunia share and the sacrificial protection charm from Lily, but is not the same charm.
‘She may have taken you grudgingly, furiously, unwillingly, bitterly,
yet still she took you, and in doing so, she sealed the charm I placed
upon you. Your mother’s sacrifice made the bond of blood the strongest
shield I could give you.’
Rowling, J.K.. Harry Potter and the Order of the Phoenix (pp.
769-770). Pottermore Publishing. Edición de Kindle.
Now, as for the duration of the blood bond charm, it appears that the charm breaks when Harry comes of age, or when Harry leaves behind Privet Drive with no intention of coming back. It would seem that becoming independent from your family (from age or from leaving them) will break the protection charm.
‘Now, your mother’s charm will only break under two conditions: when you come of age, or –’ Moody gestured around the pristine kitchen ‘– you no longer call this place home. You and your aunt and uncle are going your separate ways tonight, in the full understanding that you’re never going to live together again, correct?’
Rowling, J.K.. Harry Potter and the Deathly Hallows (pp. 36-37). Pottermore Publishing. Edición de Kindle.