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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:13:34+00:00 2026-06-14T20:13:34+00:00

I got attached jQuery datepicker with knockout custom bindings handler, and I want to

  • 0

I got attached jQuery datepicker with knockout custom bindings handler, and I want to when updating first field to set minDate of second to day after (in case that other date was not set to later date).

<label>Check-in:</label>
<input type="date" id="checkIn" data-bind="datepicker: checkIn, datepickerOptions: {
    minDate: 0,
    dateFormat: 'dd/mm/yy',
    firstDay: 1
    }" />
<br/>
<br/>

<label>Check-out:</label>
<input type="date" id="checkOut" data-bind="datepicker: checkOut, datepickerOptions: {
    minDate: 0,
    dateFormat: 'dd/mm/yy',
    firstDay: 1
    }" />

I have setup fiddle for that

e.g.
If for checkOut date is selected 28/11/2012 and you for checkIn choose 25/11/2012 there is no need to change checkOut date, only to set minDate of checkOut to 26/11/2012.

But if you choose 29/11/2012 for checkIn, then checkOut needs to update to 30/11/2012

  • 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-14T20:13:35+00:00Added an answer on June 14, 2026 at 8:13 pm

    One way to do it is to subscribe to the first date observable property and use that to set the second:

    self.checkIn.subscribe(function(newValue) {
        $("#checkOut").datepicker("option", "minDate", self.checkIn());
    });
    

    See here

    Of course, this is not the most elegant solution, since it requires knowing which part of the view relates to the other property. A better solution might be to create another custom binding.

    Something like this:

    ko.bindingHandlers.minDate = {
        update: function(element, valueAccessor) {
            var value = ko.utils.unwrapObservable(valueAccessor()),
            current = $(element).datepicker("option", "minDate", value);
        }        
    }
    

    Bound like this:

    <input type="date" id="checkOut" data-bind="{datepicker: checkOut, datepickerOptions: {
    minDate: 0,
    dateFormat: 'dd/mm/yy',
    firstDay: 1
    },
    minDate: checkIn}" />
    

    See here.

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

Sidebar

Related Questions

So I've got an NSSearchField hooked up directly to an NSArrayController via bindings, attached
I've got a situation where I want to show an object that isn't attached
I've got this HTML structure: <span id=subMenuTitle1 class=subMenuClickAble><h2>Inbox 1</h2></span> I want to attached a
I've got some XML elements with a number attached as more are available. Such
I've got a button with an onclick event listener attached (in MooTools). It works
i saw few android apps got the interface similar with itune(as attached), user can
I've got an application, which uses many listBoxes with data attached to them using
I've got a BindingSource with a BindingList<Foo> attached as the data source. I'd like
I've used some neat example's from attached URL's. What I've got so far is
I have a html form, with a custom file upload field. And by that

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.