Aqiqah is carried out on the seventh day. This is based on the hadith,
عن سمرة بن جندب أن رسول الله -صلى الله عليه وسلم- قال كل غلام رهينة بعقيقته تذبح عنه يوم سابعه ويحلق ويسمى
From Samurah bin Jundub radhiyallahu 'anhu, the Messenger of Allah -peace and prayer of Allah be upon him- said, "Every child is mortgaged with his aqiqah, is slain for him on the seventh day, has his hair shaved and is given a name." (Narrated by Abu Daud, no. 2838; An-Nasa'i, no. 4225; Ibn Majah, no. 3165; Ahmad 5: 12. Al-Hafizh Abu Thahir said that this hadith is hasan)
The meaning of the seventh day is counted from the day of birth. If the baby is born before Maghrib time, that day is counted as the seventh day. See Imam Nawawi's previous statement here: Calculation of the Seventh Day of Aqiqah.
The following is information from the scholars whether it is legal if it is done before the seventh day.
The scholars Syafi'iyah and Hambali stated that the time of slaughtering aqiqah can be started from the time of birth. Meanwhile, if done before, it is not valid and is considered an ordinary slaughter.
The Hanafiyah and Malikiyah scholars state that the time of aqiqah starts from the seventh day of birth and cannot be before that.
However, the scholars agree that the aqiqah time is sunnah on the seventh day. Meanwhile, errors or differences of opinion occurred during the slaughtering time before that.
The information above, we extract from Al-Mawsu'ah Al-Fiqhiyyah volume 30, p. 278.
If you look at its validity, aqiqah before the seventh day is still valid which is important after the baby is born. But the good thing is on the seventh day after birth because that time is agreed upon.
Hopefully it will be useful knowledge.