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!!
Copy link to clipboard
Copied
What's the format of your date fields?
Copy link to clipboard
Copied
Hi,
The format is in dd-mmm-yyyy.
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.
Copy link to clipboard
Copied
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!!