Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Knockout bind HTML datepicker min and max

I have two HTML date pickers that I am having trouble with. What I am trying to do is set the value and apply a minimum and maximum criteria with Knockout. After much research I found the proper date format for the proper format for value, min, and maximum. Trouble is, the min and max does not seem to work.

Here is my HTML date picker:

<input type="date" data-bind="value: MinDate, min: MinDateRange, max: MaxDateRange" />

The format of all the dates is yyyy-MM-dd in accordance with the link I sent. If I manually apply the min and max as attributes the date format works just fine. Anyone have any idea what I am doing wrong?

like image 620
Chase Avatar asked Mar 05 '26 14:03

Chase


1 Answers

You can't just use min and max because there is no such bindingHandlers. But you can use attr bindingHandler:

<input type="date" data-bind="value: MinDate, attr: { min: MinDateRange, max: MaxDateRange }" />
like image 140
Sławomir Rosiek Avatar answered Mar 08 '26 03:03

Sławomir Rosiek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!