How to restrict number of leaves for a Specific Leave Type based on Date of Joining

Hi,

In our organization we provide 5 Festival holidays to each employee. However, for the first year based on employee’s date of joining, it will be less. You can find the logic below.

Date of Joining in Between No of Holidays
01-01-2024 To 13-03-2024 5
14-03-2024 To 25-05-2024 4
26-05-2024 To 06-08-2024 3
07-08-2024 To 18-10-2024 2
19-10-2024 To 31-12-2024 1

I have created festival leave type. Based on employee he/she should only select predefined no of leaves for that leave type.

Also, I have added specific dates to holidays list. By default when they select these dates and apply for leave it wont count as leave, as it is holiday.

How can i implement, number of leaves allowed based on the date of joining for specific leave type?