Solved

JQuery help with datepicker - minDate

Posted on 2012-12-20
4
981 Views
Last Modified: 2013-01-12
How can I modify this script to "block" current date in my calendar datepicker popup?  I don't want users to pick the current date for my appointment application, ie., no same-day appointments allowed.  I'm modifying existing code and do not know javascript well.

$(document).ready(function() {
    $(#div_date").hide();
});

$(function () {
    $(#apptDate").datepicker({ beforeShowDay: $.datepicker.noWeekends}
  );
     $("#date_pickup_icon").click(function () {
        $("#apptDate").datepicker("show");
     });
});

_____________________
I use the jquery library.  There is an attribute (excuse the incorrect terminology); "minDate".  Default is NULL.  How do I use this to specify the blocking of the current date and previous dates.
0
Comment
Question by:newBieProgram
  • 2
4 Comments
 
LVL 3

Expert Comment

by:KevinSchmaltz
Comment Utility
I think you want to set the mindate equal to 1 check out the link below:

http://stackoverflow.com/questions/3247656/jquery-ui-datepicker-disable-todays-date-if-today-is-monday
0
 
LVL 4

Accepted Solution

by:
brendonfeeley earned 500 total points
Comment Utility
minDate needs to be set to +1d

Try this:

$(document).ready(function() {
      $(#div_date").hide();
});

$(function () {
      $(#apptDate").datepicker({
            minDate: '+1d',
            beforeShowDay: $.datepicker.noWeekends
      }
  );
       $("#date_pickup_icon").click(function () {
            $("#apptDate").datepicker("show");
       });
});
0
 

Author Comment

by:newBieProgram
Comment Utility
I will try this. Thank you.
0
 

Author Comment

by:newBieProgram
Comment Utility
Yes, it worked.  I set the minDate to +1.  Thank you!  Very much appreciated!
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This article will show, step by step, how to integrate R code into a R Sweave document
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now