Counting 31.12.'s within a Date Range
Assuming you mean "open interval" in the ordinary mathematical sense, being that the end dates themselves are excluded, then...
If you just want to work with the textual form, split each date into DD.MM and YYYY components j1=d1[0:5]; y1=int(d1[6:]); y2=int(d2[6:]).
Subtract the "start" year from the "finish" year, subtract one more if the first date is 31.12: n = y2 - y1 - int(j1 == "31.12")
Take the maximum of this and zero (because the answer cannot be negative): if (n<0): n=0
Alternatively, if you have dates represented in a computable form (e.g. Julian day numbers, Unix Epoch seconds, etc) start by adding one day to the "start" date; then take the year of each date, subtract one from the other, and you have your answer.
Sanity checking both approaches, consider:

any two dates in the same year: answer is 0.
31.12.2020 to 31.12.2021: answer is 0.
30.12.2020 to 01.01.2021: answer is 1.
I got 2 columns stating the start and end dates of an event in my data frame. I need to calculate the number of 31.12.XXXX's within that range (while treating it as an open interval). Any help is appreciated, thank you.