0
 <td> <input id="dt_dec_date" data-bind="datepicker: vm.afi.Details.DecisionDate" /> </td> DecisionDate: ko.observable(), 

I need to ensure that the date is not more than today, I have tried using max but cant get it to work, any ideas.

Sorry if this is really simple but I ma new to knockout. I have this value coming from a server but the user is allowed to change it but can't go beyond todays date.

1
  • You need to show us the custom binding Commented Aug 15, 2014 at 11:33

1 Answer 1

1

Heavily inspired by this answer. Suppose, that you're using datepicker binding from that mentioned answer, then you just need to use the following markup:

<input id="dt_dec_date" data-bind="datepicker: decisionDate, datepickerOptions: { maxDate: new Date() }" /> 

And view model is:

var viewModel = { ... decisionDate: ko.observable(new Date("08/15/2014")), ... }; 

See the demo.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.