Skip to main content
Participant
November 19, 2018
Answered

conditional date

  • November 19, 2018
  • 1 reply
  • 579 views

I've looked for several days and have seen a variety of ways my problem has been done in Adobe Javascript, but none have worked for me.

The Problem:  On an exhibitor application form for a meeting I am holding, the exhibitor enters NumberOfTables requested.  The text box (AmountDue), will reflect the number of tables times the per table fee.  The per table fees depends on whether Today's Date, i.e., the date the customer enters the NumberOfTables amount, falls on or before the regular registration cutoff date 3/16/19 (@ $425/table) or after the cutoff date (@ $550/table).

This seems like a straightforward matter, but it has eluded me.  I gather that I can declare "var TodaysDate = new Date()", for the given date when the NumberOfTables field is entered, and "var DeadlineDate = new Date('2019,03,16')"  for providing the date to compare to.  But then I run into trouble in terms of whether I should declare "var DeadlineDate =new Date(2019/03/16) as I've seen in some answers, or even "var DeadlineDate = new Date(2019/03/16)" as I've also seen. Then I really lose it when creating my "if...then statement"  I've learned several programming languages in the past (a while ago) but am stumped by Adobe Javascript.

Thanks for any help you can give.

~~Rich

This topic has been closed for replies.
Correct answer try67

To get the date you need you can use this:

var DeadlineDate = new Date(2019,2,16);

Or:

var DeadlineDate = util.scand("mm/dd/yyyy", "03/16/2019");

Note that in the former the month number is 2, as it is zero-based.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
November 19, 2018

To get the date you need you can use this:

var DeadlineDate = new Date(2019,2,16);

Or:

var DeadlineDate = util.scand("mm/dd/yyyy", "03/16/2019");

Note that in the former the month number is 2, as it is zero-based.

RichButchAuthor
Participant
November 20, 2018

Thank you, try67,

This will definitely help an important part of my problem.  I'll check it out and see if I can make it work with my whole "if...then"  formula.

~~Rich