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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:08:43+00:00 2026-05-26T10:08:43+00:00

I made two date fields (pickup and dropin). And, I want to make sure

  • 0

I made two date fields (“pickup” and “dropin”). And, I want to make sure that:

  1. Pickup date should be earlier than dropin date.

  2. When a user already choose his dropin and pickup dates and later he changes the pickup date later than dropin date, then the script automatically changes his dropin date later than the user chose.
    (for example, a user put “12/07/2011” in pickup date and “13/07/2011” in dropin date then later he changes his pickup date to “13/08/2011”. If so, the script should set “13/08/2011” as the dropin date.

I referred to one of threads in this site. And, the following is the code I am having right now.

  $.datepicker.setDefaults({dateFormat: 'dd/mm/yy'});
  $("#pickup").datepicker({
            onSelect: function(dateText, inst){
              var minDate = $(this).datepicker('getDate');
              $('#dropin').datepicker('destroy').datepicker({
                        minDate: minDate
                    });
             },
            onClose: function(dateText, inst) {
                if(dateText == '') {
                    $('#dropin').val('');
                $('#dropin').datepicker('destroy').datepicker();
                }
             }
            });

            $("#dropin").datepicker();
            var set=$("#dropin").datepicker('getDate');
            alert(set.getDate());

It looks like that it satisfies the first one. But, I have no idea about the second constraint. And, it keeps stating that ‘s’ is null.

Can you help me with the issue?
Thank you very much.

  • 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-26T10:08:43+00:00Added an answer on May 26, 2026 at 10:08 am

    Try somethig like this:

        var date = new Date();
        $.datepicker.setDefaults({
            'dateFormat' : 'yy-mm-dd',
            'onSelect' : function(dateText, inst){
                instance = $(this).data('datepicker'),
                selectedDate = $.datepicker.parseDate(
                    instance.settings.dateFormat || $.datepicker._defaults.dateFormat,
                    dateText,
                    instance.settings
                );
                if (this.id == 'datepicker-pickup') {
                    $('#' + 'datepicker-dropin')
                        .datepicker('option', 'minDate', selectedDate)
                        .datepicker('refresh');
                    datePickup = dateText;
                }
                if (this.id == 'datepicker-dropin') {
                    $('#' + 'datepicker-pickup')
                        .datepicker('option', 'maxDate', selectedDate)
                        .datepicker('refresh');
                    dateDropin = dateText;
                }
            }
        });
        $('#datepicker-pickup').datepicker({
            'defaultDate' : datePickup,
            'maxDate' : dateDropin
        });
        $('#datepicker-dropin').datepicker({
            'defaultDate' : dateDropin,
            'minDate' : datePickup,
            'maxDate' : new Date(date.getFullYear(), date.getMonth(), date.getDate())
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made query that accepts two parameters. Now I want to use that query
Context: .Net, C# I want to print a complex number made from two doubles.
I made this function to verify a user's twitter credentials. Its running on two
I have an object and I want to delay an operation. I made two
I am making a chat window, i just want that message and date time
I have a few user controls I made in wpf that are driven by
Okay, I have two different background .jpgs that I want to used as the
I have a text file that contains date, and two time-strings separated by spaces
Given the case I made two independent changes in one file: eg. added a
Our application is currently made up of two big entities: C# ASPX files, and

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.