TotalChoiceNate Posted May 2, 2017 Share Posted May 2, 2017 Hello! Relatively new to FP and Javascript and had a hard time finding anything about this on the forum, and I'm hoping it is a quick fix. Basically the issue that I am running in to is that my customer has a calendar date input on their portal for an event date that needs formatted, and the rule right now is returning todays date regardless of the input due to the "MyDate = FormatDate(Today(), "ld, lm d, yyyy");" The thing is that I know how it is breaking, but when i change the FormatDate(Today() to FormatDate(Field(Date) it breaks the code. I've attached the full code below, any help would be much appreciated! MyColor = Field("ColorChoice"); MyDate = FormatDate(Today(), "ld, lm d, yyyy"); MyTime = Field("Time"); if (Field("Date") != "" && Field("Time") != "") { return '<color name = "'+MyColor+'">' + MyDate + ", " + MyTime; } else if (Field("Date") != "" && Field("Time") == "") { return '<color name = "'+MyColor+'">' + MyDate; } else if (Field("Date") == "" && Field("Time") != "") { return '<color name = "'+MyColor+'">' + MyTime; } else { return ""; } Quote Link to comment Share on other sites More sharing options...
step Posted May 2, 2017 Share Posted May 2, 2017 What is the format of the "Date" field? You could try this: MyDate = FormatDate(DateFromString(Field("Date")), "ld, lm d, yyyy"); Quote Link to comment Share on other sites More sharing options...
TotalChoiceNate Posted May 3, 2017 Author Share Posted May 3, 2017 The date format is just input from the MarcomCentral calendar on the form, after testing it out your suggestion fixed the problem! Thank you so much! 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.