Deductions & credits

Thank you! Just to make sure I understand the codes to enter on 1099-R. I see that Code J is "Early Distribution of Roth IRA" and Code P is "Excess contributions plus earnings/excess deferrals taxable in 2020". Code J makes sense to me, but Code P confuses me with the "2020" part...since it was in 2021? Can you explain that? I also saw Code 8 "Excess contributions plus earnings/excess deferrals (and/or earnings) taxable in 2021". Is this ever selected in this case?