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 8589633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:06:14+00:00 2026-06-11T23:06:14+00:00

I have two datePickers in the same page and I wanna change the second

  • 0

I have two datePickers in the same page and I wanna change the second datepicker’s minDate depending the first one. Here is my code:

$("#datepickerDepart" ).datepicker({
        dateFormat: "mm-dd-yy", 
                minDate: 0,
        onSelect: function(dateText, inst) {
          var m = dateText.substring(0,2);
          var d = dateText.substring(3,5);
          var y = dateText.substring(6,10);
          console.log(d);
          console.log(m);
          console.log(y);
          var newDate = new Date(y,m-1,d);
          console.log(newDate);
          $('#datepickerReturn').val("");
                      $('#datepickerReturn').datepicker({
              dateFormat: "mm-dd-yy",
              minDate: newDate
          })
             }
});

But I have a question, the first time I select a date in the first datePicker, the minDate of second one will be set according to this, but when I reselect the first one, the second datePicker’s minDate won’t change anymore, it will remain. I don’t know why. Please help!!

I just wanna the minDate of the second one will change as long as the selected date of the first one change.

  • 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-06-11T23:06:15+00:00Added an answer on June 11, 2026 at 11:06 pm
    $("#strStartDate").datepicker({ 
      dateFormat: 'dd/mm/yy', 
      constrainInput: true,
      firstDay: 1,
      hideIfNoPrevNext: true,
      onSelect: function(){
            if ($("#strStartDate").val() > $("#strEndDate").val()){
                $("#strEndDate").val($("#strStartDate").val());
            }
      }
    

    });

    $("#strEndDate").datepicker({ 
      dateFormat: 'dd/mm/yy', 
      constrainInput: true,
      firstDay: 1,
      hideIfNoPrevNext: true,
      beforeShow: function (input, inst) {
            inst.settings.minDate = $("#strStartDate").val();
     }
    

    });

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

Sidebar

Related Questions

I have two datepickers: $('#Date1, #Date2').datepicker({ defaultDate: +1, minDate: +1 }); Whenever I select
I have two jQueryUI datepickers on my page. They're initialised as below: jQuery(#departureDate).datepicker({ beforeShow:
H I need to customize two datepickers. First shold have: minDate: last ten days
I have two jquery ui datepickers in my page and I would like to
I have two inline datepickers on my page to select a date range: As
I have two datepickers at the moment, one for a start date, and another
I have two datepicker fields, one is ' start date ' the other is
I have two datepickers. When start date is selected, end date is automatically assigned
I have two date pickers one for startDate and another one is for endDate.
I'm using the jQuery datepicker where I have two textboxes (start date / end

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.