that is only needed if you are actually going to display a day in the month. accurately, as there is no 0 day,
I know I put that in mod, when the display changed in Vanilla, then it was improved upon. Haven't checked
the display part of Vanilla to see if Vren changed that or not, did tell him.
But the code
define the fertile day in a month, values would be a random number from 0 to 30
self.ideal_fertile_day = renpy.random.randint(0,30) 
day_difference = abs((day % 30) - self.ideal_fertile_day)
would have up to 31 possible values before the absolute value is applied. but if (day % 30) = 0 then those values are from 0 to -30, and that will be the only time that 31 possible values after the abs is applied, all other values of (day % 30) will only have 30 possible values after abs is done. 
now having a 30 day cycle is one thing but it must be mapped to the, but looking at this now beyond having 31 days and a miss calculation in day difference because the 30 days are not mapped initially or tracked, the assumption being it will always be that day of a month. minor details (horrible if you are dealing with calandar and dates in the real world but it is just a game)
I just can't find where or if the fertile date is displayed in Vanilla,
But if the same assumptions are made around pregnancy, I know and it has been shown that it is a display bug but investigating where that display bug is happening. hasn't been shown.