HubKonnect Studio Posted August 7 Share Posted August 7 To preface, this will be used on a coupon that currently has a start date and an end date field for the user to choose. The client has asked for end dates to automatically be one year from the start date that is selected with the end date being a required but hidden field for the user. Can. rule be written so the end date field can be automatically populated with a date that is one year from the start date that the user selects? The field names in my flat file data are "OfferStartDate" and "OfferStartDate". Thanks! Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted August 7 Share Posted August 7 var myDate = DateFromString(Field("OfferStartDate")); myDate.setFullYear(myDate.getFullYear() + 1); return FormatDate(myDate, "mm/dd/yyyy"); You can format the resulting date however you want in the last line. (Refer to the Rules Guide.) Quote Link to comment Share on other sites More sharing options...
Mike_Marshfield Posted September 12 Share Posted September 12 @Dan Korn this rule isn’t working that you supplied var myDate = DateFromString(Field("OfferStartDate")); myDate.setFullYear(myDate.getFullYear() + 1); return FormatDate(myDate, "mm/dd/yyyy"); do I need to add or delete something to make it work? I have a todays date rule called “Date Rule” that I replaced the “offerstartdate” any advice? Quote Link to comment Share on other sites More sharing options...
Alex Marshall Posted September 12 Share Posted September 12 Did you insert this new Rule from the "Variable" drop window in the FusionPro Variable Text Editor to the text frame used? Quote Link to comment Share on other sites More sharing options...
Mike_Marshfield Posted September 12 Share Posted September 12 So I have a todays date rule and need a rule for one year from today’s date Quote Link to comment Share on other sites More sharing options...
Alex Marshall Posted September 12 Share Posted September 12 Can you collect the job (FusionPro>>Collect) and forward it to fusionprosupport@marcom.com Quote Link to comment Share on other sites More sharing options...
Mike_Marshfield Posted September 12 Share Posted September 12 Not sure you will be able to see that email Alex so my today’s date rule is this return FormatDate (new Date (), “1m d, yyyy”); so I need another rule for 1 year from todays date Quote Link to comment Share on other sites More sharing options...
Mike_Marshfield Posted September 12 Share Posted September 12 Alex I got it to work. Just needed to add “Rule” where it says “Field” 1 Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted September 12 Share Posted September 12 1 hour ago, Mike_Marshfield said: Not sure you will be able to see that email Alex so my today’s date rule is this return FormatDate (new Date (), “1m d, yyyy”); so I need another rule for 1 year from todays date In that case, you don't need that second rule to format the current date just to have the other rule call it. You can just have a single rule like so: var myDate = new Date(); myDate.setFullYear(myDate.getFullYear() + 1); return FormatDate(myDate, "mm/dd/yyyy"); or: var myDate = Today(); myDate.setFullYear(myDate.getFullYear() + 1); return FormatDate(myDate, "mm/dd/yyyy"); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.