Edited the snippet from above to reflect that the correct usage is with date2num (obviously)
Of course using the If from backtrader allows for much more complex scenarios. The 1 + boolean in the snippet was just meant to solve the hypothetical case presented above (1 until date x, 2 from that point onwards)