I have found scripts on this site that allow me to restrict datepickers to dates greater than today in one table, and to dates earlier than today in another table - yay! Now I am looking for scripts that will allow me to dynamically restrict dates to the current calendar year only in one table, and to the next calendar year only in another table. Thank you.
Question
Question
Limit datepicker to current calendar year and to future calendar year, in tables
asked on August 1, 2019
0
0
Replies
replied on August 1, 2019
•
Show version history
You just need to edit the part of the script that sets the date and only use the year part. Pay attention to the part of the script building the min/max attributes; all you really need to do is get a year but set fixed month/day values.
For example, the script gets a date object, then only use the Year portion
date min/max is always formatted as yyyy-MM-dd, so
yyyy-01-01 is the start of the year
yyyy-12-31 is the end of the year
and you only need to set the yyyy portion.
For setting the following year, you would need to create a date object with the current date and add one year.
0
0
You are not allowed to follow up in this post.