Calculate salary based on employee tenure

I have a system where employee salary is deducted by 5% until they complete 12 months at office after joining. This amount will be paid to the employee along with the 12th/or 13th month salary.
To understand,
Lets skip income tax for now.
Employee join date: 2021-06-15
Lets say, basic salary = 50,000
Salary net to be received at the end of June 2021 for half month based on join date: 25000
Salary received after deducting 5% = 23750
From July 2021 Employee receives = 47500/month until 2022-05 salary
In June 2022, employee must receive:
50000 July 2022 salary (no 5% deduction as 12 months completed on 15th June)
1250 (deduction from 2021 June)
2500*11 (deductions from July 2021 to May 2022)
Total: 78750

To achieve this, I created a salary component named Retention and formula is basic salary * 0.05.

I am stuck at creating a condition to check 12 months from join date.

Any solutions to this ?