Wouldn't it be less work to just create two emails?
I don't think you need scripting for this anyway.
Just use two filters in a normal smartlist
Anniversary date is after x
Anniversary date is before y
Thanks for the suggestions! I know that if I build it as separate emails using smartlist to filter it, it would work for the scenario above but what I'm asking is just one part of the content. It has multiple dynamic content with several conditions so if built as static emails there would be too many versions and that's what I'm trying to avoid.