Repeat rules for "TwiceAMonth" frequency
Many of the frequency enum types are self explanatory for finding the next occurrence. But `TwiceAMonth` seems to be an old ball. What are the rules for finding the next occurrence? It seems like it is close to every 15 days with some exceptions for dates after the 15th of the month.
Joshua Peek I'm going to double-check on this, but when we looked into this a bit ago, it followed something like this:
First occurrence date + 15 days for the second occurrence, except if that occurrence lands on the 31st of a month. Then it pushes forward to the 1st of the next month.
Does that match what you're seeing?
Hi again, Joshua Peek ! I had Brady walk me through the logic here and, you're right, it's not overly straightforward :)
Basically, if the first date is on or before the 15th of the month, we add 15 days to get the second occurrence. If 15 days past that (think February) goes past the end of the month, the second occurrence happens on the last day of the month.
After that first month, the dates will stay the same (i.e. 13th & 28th).
If the first date is after the 15th, we subtract 15 from the first date and pretend that was the first, then use the above logic :)