Jump to content

Expiration Date Rule


Summer

Recommended Posts

Hi everyone,

 

I'm programming a postcard that requires an expiration date for coupon redemption. Most of the redemption periods are 30 days, and to account for the time it takes for production and mailing (about 6 days), currently I have this rule in place:

 

var today=new Date()

today.setDate(today.getDate()+36)

return (FormatDate(today, "mm/dd/yy"));

 

So that rule takes today's date, or whatever date the print files are composed, and it adds 36 days to it. If I composed print files today, the expiration date would be 12/9/10. My problem is that now, instead of only a 30-day redemption period, I'm dealing with both 30 and 60 day options.

 

The data/mail file that I link to the template has a field titled RewardsExpiration which simply says "30" or "60" and that needs to be my trigger field in the rule so it switches the date accordingly. Because the rule above does not utilize the RewardsExpiration field, I'm having a hard time manipulating this rule to make it work for both time periods, plus keeping my date formatting as XX/XX/XX. Can anyone shed light on this for me? I'd really appreciate it!

 

Thanks in advance,

~Summer

Link to comment
Share on other sites

Nice future date solution.

 

For the option of 30 or 60, couldn't you just create a variable

var futureDate = StringToNumber(Field("RewardsExpiration")) + 6;

and then edit your 2nd line of code to read

today.setDate(today.getDate()+futureDate);

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...