I have the following code to sets the minimum date for a date field (Class is PropDate).
$(function() { $(document).ready(function () { var todaysDate = new Date(); // Gets today's date // Min date attribute is in "YYYY-MM-DD". Need to format today's date accordingly var year = todaysDate.getFullYear(); // YYYY var month = ("0" + (todaysDate.getMonth() + 1)).slice(-2); // MM var day = ("0" + todaysDate.getDate()).slice(-2); // DD var minDate = (year +"-"+ month +"-"+ day); // Results in "YYYY-MM-DD" for today's date // Now to set the min date value for the calendar to be today's date $('.PropDate input').attr('min',minDate); }); });
I ended up having to add a status field (Task Scheduling) for items that are to be delayed more than 30 days. If "Delay" is picked from the status field, the date minimum should be 30 days from the current date, but if it is not chosen, the minimum date from the code is maintained. Can anyone help me adjust this code to function in that manner? Sorry, not great with coding.