Link to function in question
The problem is that multiple leap days that remove days with different offsets could collide on certain years, effectively making that month have negative days, because I have no simple way to calculate how often that collision happens
Say you have a month with a length of 1, and you have two leap days that remove a day from that month:
- One leap day has an interval of 5 and an offset of 1, it would remove a day from that month every 5th year starting year 1, then 6, 11, 16, 21, 26, 31 etc
- The other leap day has an interval of 8 and an offset of 0, meaning it removes a day from that month on year 8, 16, 32, 40, 48, etc
Detecting these collisions with NO offsets is easy, as you would do LCM, least common multiple, eg, how often does 5 and 8 collide? Every 40 years, because simple numbers, but in the case with offsets, LCM breaks down.
This is used in epoch calculation, which is used to determine the year's starting week day, the weather, the moon cycles, some event calculations, etc, so it is very important to get right.
If we can solve this, we could also solve having multiple offsets for one leap day. For example, a leap day that happens every 5th (1 offset) and 3rd year (2 offset)
- First interval would be 1, 6, 11, 16, 21, 26, 31, 36
- Second interval would be 2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35
These collisions need to be able to be detected on leap day level, too