• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Changing date field color based on difference in month

New Here ,
Mar 01, 2020 Mar 01, 2020

Copy link to clipboard

Copied

Hi,

I am creating a checklist with a "From Date" and an "To Date".

I have another field called "Completed Date". How do i script so that the "Completed Date" field will be filled with Red color if the difference between the "Completed Date" and the "To Date" is less than say 5 months.

I tried reading the "Working with Date and Time" guide but its too much for my understanding.

Thank you!!

TOPICS
Acrobat SDK and JavaScript

Views

298

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 02, 2020 Mar 02, 2020

Copy link to clipboard

Copied

What's the format of your date fields?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 02, 2020 Mar 02, 2020

Copy link to clipboard

Copied

Hi,

The format is in dd-mmm-yyyy. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 02, 2020 Mar 02, 2020

Copy link to clipboard

Copied

OK. However, calculating the difference in months is tricky, as each month has a different length, so you need to clearly described how it should work first.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 02, 2020 Mar 02, 2020

Copy link to clipboard

Copied

LATEST

Hi. Thanks for trying to help me. I read the same thing about months ... what if I try to calculate in weeks instead. 

 

Here is how I am envisioning the script to work.

 

I have a "Start Date" and "End Date" of an event happening listed in another date fields on the form.

On this checklist that I have is a list of steps that will need to be completed within a certain timeframe before the start date of the event, and some steps to be taken after the event.

1) If the actions completed is more than 8 weeks, then the field will be filled with Green color.

2) If the actions completed is less than 8 weeks, then the field will be filled with Yellow color.

3) If the actions completed is less than 3 weeks, then the field will be filled with Red color.

I have 53 items on this checklist ... and some will be referencing to the End Date of the event.

 

Thank you so much!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines