How would we legally define this?
The baby isn't a person when it's 23 weeks, 6 days, 23 hours and 59 seconds old but when it's 24 weeks old, in that magical second, it became a person.
It's not ideal, but it's one solution that is already used the world over for anything age related - being able to drive, drink, get married, join the military, etc.