Jump to content

Issue with Date input


Recommended Posts

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 "";

}

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...