Copy link to clipboard
Copied
In a created form, I am trying to figure out how to use javascript to ensure that a selected date in a date field labeled "Start Date" is greater than 90 days from the current day/today. I would also like to implement alerts to convey a message to the user when the start date is greater than, less than, and equal to 90 days. I dont have any experience in javascript. Can anyone help with this?
Copy link to clipboard
Copied
What should happen if it's not? Should the value be rejected, or just show an error message?
What is the date format of that field?
Copy link to clipboard
Copied
Hello, recognized your name from my other post 🙂 I'm also trying to figure out the above. If the date entered is greater than 90 days, I need an error message to display. Format is m/dd/yyyy. Any help is super appreciated. Thanks.
Copy link to clipboard
Copied
Dates are more complicated than regular calculations because Dates are more complex.
You can read about scripting for Date Handling here:
https://acrobatusers.com/tutorials/date_time_part1/
https://acrobatusers.com/tutorials/date_time_part2/
There are two important bits for such a script
1) Parsing the entered date text into a Date object
2) Adding 90 days to the current date so the date objects can be compared.