Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 2nd, 2017, 02:28 PM
TotalChoiceNate TotalChoiceNate is offline
Junior Community Member
 
Join Date: Dec 2016
Posts: 17
Default Issue with Date input

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 "";
}
Reply With Quote
  #2  
Old May 2nd, 2017, 03:51 PM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 955
Default Re: Issue with Date input

What is the format of the "Date" field? You could try this:
Code:
MyDate = FormatDate(DateFromString(Field("Date")), "ld, lm d, yyyy");
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
  #3  
Old May 3rd, 2017, 06:04 AM
TotalChoiceNate TotalChoiceNate is offline
Junior Community Member
 
Join Date: Dec 2016
Posts: 17
Default Re: Issue with Date input

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!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 06:44 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.