Retirement tax questions

I was told that " 

If you accidentally overcontributed to a Roth IRA, you need to withdraw the excess amount including any earnings before your tax filing deadline to avoid a 6% penalty each year the excess remains in the account. 

 

he did withdraw before 4/15/25. So why would he have to pay the penalty? Or am I missing something? I over contributed to a Trad IRA. But the custodian left the earnings in there. is there a penalty if I remove that before the 15th? thanks.