Solved

JQuery help with datepicker - minDate

Posted on 2012-12-20
4
1,044 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Expert Comment

by:KevinSchmaltz
ID: 38711213
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
ID: 38713071
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
ID: 38714917
I will try this. Thank you.
0
 

Author Comment

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

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn how to dynamically set the form action using jQuery.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

691 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