Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6549275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:04:24+00:00 2026-05-25T12:04:24+00:00

I am in need of having the maxDate for my jQueryUI date picker dynamically

  • 0

I am in need of having the maxDate for my jQueryUI date picker dynamically update depending on the day. Right now, as you will see below, there is a function being used to disable Monday-Thursday because our team can only report issues Friday-Sunday. So what I need to do is have it so that the team can continue to report on the weekend but not for the next weekend until Thursday. For example, today is Monday, the team can still report on issues from last Thursday-Sunday and won’t be able to select a day for next weekend until Thursday. Is this possible?

Here is the code I have so far:

  var fullDate = new Date();
  var twoDigitMonth = ((fullDate.getMonth().length+1) === 1)? (fullDate.getMonth()+1) : '0' + (fullDate.getMonth()+1);      

  $('#startdate').datepicker({
    maxDate: twoDigitMonth + "/" + fullDate.getDate() + "/" + fullDate.getFullYear(),
    beforeShowDay: disableSpecificWeekDays
  });


  function disableSpecificWeekDays(date) {
    if((date.getDay()==0) || (date.getDay() == 5) || (date.getDay() == 6) ){
        return [true];
    }else{
        return [false];
    }
  }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:04:25+00:00Added an answer on May 25, 2026 at 12:04 pm

    Something like this should work for you:

    function getMaxDate() {
        // Maximum date is today by default.
        var maxDate = new Date();
    
        // Is today Thursday or greater (Thurs. - Sat.)
        if (maxDate.getDay() >= 4) {
            // Yes? Make the date today's date plus the difference between today and
            // next Sunday
            maxDate.setDate(
                maxDate.getDate() + (7 - maxDate.getDay()));
        }
        return maxDate;
    }
    
    $('#startdate').datepicker({
        maxDate: getMaxDate(),
        beforeShowDay: disableSpecificWeekDays
    });
    

    Example: http://jsfiddle.net/RxQB4/

    Basically, write a function that encapsulates your logic. When initializing the datepicker, call that function to retrieve the maximum date.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need the package having below features: needs client based secure file transfer machanism
Right now I have class MyParamClass { all the parameters I need to pass
I need a control having these features: It should be possible use it in
I am having a page where i need to confirm whether to show updated
I need to list all filenames which is having alien.digits digits can be anytime
I am having an issue where I need to be able to specify the
We need to protect a class from having static methods for security purposes. We
I am having a procedure where i need to check the status in the
I need to devise a subquery to select the rows having matching values in
I need to compare two Unix timestamps and I'm having trouble with the math.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.