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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:45:19+00:00 2026-06-03T18:45:19+00:00

I try to create a date range by using the jQuery UI datepicker, using

  • 0

I try to create a date range by using the jQuery UI datepicker, using two text fields. The first text field “start_date” will set the start date and the second text field “end_date” will set the end date.

The code I have till now is this:

$('#start_date').live(
    'focus',
    function()
    {
        $('#end_date').datepicker(
            {
                dateFormat: 'dd MM yy',
                minDate: new Date(),
                maxDate: new Date(2012, 9, 15),
                stepMonths: 2,
                numberOfMonths: 2
            }
        );

        $(this).datepicker(
            {
                dateFormat: 'dd MM yy',
                minDate: new Date(),
                maxDate: new Date(2012, 9, 15),
                stepMonths: 2,
                numberOfMonths: 2,
                onSelect: function(dateText, inst)
                {
                    var instance = $( this ).data("datepicker");

                    var date = $.datepicker.parseDate(instance.settings.dateFormat, dateText, instance.settings);

                    $('#end_date').datepicker('option', 'minDate', dateText);
                }
            }
        );
    }
);

NOTE : I use the live and the focus event because all my page content is loaded with AJAX call. Maybe that is correct or wrong, but this is not what I like to ask here 😉

The above code is correct for me and work fine, but what I like to do, is to set the value of the ‘end_date’ element to selected one +3 days.

Until now, when I choose a date at the “start_date” element the “end_date” element change to the same date as the “start_date”, and this is what I like to change. The “end_date” to be +3 days from the “start_date” element adter the selection.

How can I do that ?

  • 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-03T18:45:21+00:00Added an answer on June 3, 2026 at 6:45 pm

    To set end_date for +1 day

    onSelect: function(dateText, inst) {
        $('#start_date').datepicker('option','minDate', new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay));
        var toDate = new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay);//Date one month after selected date
        var oneDay = new Date(toDate.getTime()+86400000);
        document.getElementById('end_date').value =$.datepicker.formatDate('dd/mm/yy', oneDay);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to create MS Access Table with autoincrement ID and Default Date field,
I try to create a very simple app using windows API. I've done some
I cannot use Joda. When I try to create a Date or Calendar from
I am trying to get a date range using Guava's new Range functionality, via
I have a stored function in MySQL: CREATE FUNCTION `login_count`(o INT, start_date DATE, end_date
I try to get a decimal amount of months for a date range. Example:
When i try to create or save a date in the model the validation
I want to try create something like Zend's Server Pagecache. What I want to
I try to create a progress bar that displays the progress of a parser
I try to create Twitter client and now I deal with authorization via OAuth

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.