This is a migrated thread and some comments may be shown as answers.

Min/Max bindings for DatePicker and TimePicker

16 Answers 1159 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 11 Apr 2012, 09:52 PM
Is it possible to bind the Min & max settings for a time and date picker from a model? So if I have a StartDate and EndDate property I can make sure that startdate is always before the enddate and vise versa?

16 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 12 Apr 2012, 01:48 PM
Hello Jonathan,

I am afraid that this functionality is not supported at present. The developers are aware of that limitation and this feature will be included in our future releases.
Currently you can set up min and max values only through the configuration options.

Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Anil
Top achievements
Rank 1
answered on 14 Aug 2013, 09:54 PM
Hi, Is this functionality currently supported in Q2 release of Kendo UI

Thanks,
Anil
0
Alexander Valchev
Telerik team
answered on 16 Aug 2013, 08:40 AM
Hello Anil,

To achieve this you can use custom bindings. I prepared a jsBin example that demonstrates the implementation:

Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Anil
Top achievements
Rank 1
answered on 10 Apr 2014, 09:00 PM
Hello Alexander, Is there an alternate mechanism to doing this other than custom bindings. has anything been done on this for the 2014 Q1 release.

Thanks,
Anil
0
Alexander Valchev
Telerik team
answered on 14 Apr 2014, 02:59 PM
Hello Anil,

Since Q1 2014 the DatePicker supports min/max values as HTML attributes. For example:
<input id="birthdate" name="birthdate" value="" max="1993-12-07" />
<script>
    $("#birthdate").kendoDatePicker();
</script>


Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Steven
Top achievements
Rank 1
answered on 03 Sep 2014, 07:57 PM
Why does this not work?

<input 
            data-role="datepicker" 
            data-format="MMMM yyyy"
            data-depth="year"
            data-start="year"
            data-max="selectedMaxDate"
            data-bind="value:selectedMinDate">
0
Alexander Valchev
Telerik team
answered on 04 Sep 2014, 02:54 PM
Hello Steven,

As discussed in the previous replies, it is not possible to set the min/max configuration options of the widget via data attributes.
Please use the HTML5 min/max input attributes as described below.

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Keith
Top achievements
Rank 2
Iron
Veteran
answered on 17 Aug 2015, 09:20 PM
How would I set it up to max with today's date?
0
Petyo
Telerik team
answered on 20 Aug 2015, 09:53 AM

Hello Keith,

there is no direct way to assign the max to a dynamic date via html attributes - strings like "today" won't be parsed. You may do that with jQuery initialization, though.  

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Keith
Top achievements
Rank 2
Iron
Veteran
answered on 26 Aug 2015, 05:08 PM
Thanks,  I'll give it a try that way.
0
Curt Rabon
Top achievements
Rank 1
Veteran
answered on 15 Jul 2016, 08:00 PM
Support for this seems to have been added somewhere between 2013 and 2016.2.  It's working for me using data-min, etc.  Please give me the URL of the documentation page for this, thanks.
0
Petyo
Telerik team
answered on 21 Jul 2016, 06:49 AM
Hi,

the static assignment through the data attributes works as expected - the thread discusses the possibility of binding these values to a view model values, which is not supported.

Regards,
Petyo
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
0
T. Tsonev
Telerik team
answered on 21 Jul 2016, 06:55 AM
Hello,

Options, including min and max, can be set via data attributes initialization. These are not MVVM bindings and will not update the widget if the attribute value changes.

I hope this helps.

Regards,
T. Tsonev
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
0
Curt Rabon
Top achievements
Rank 1
Veteran
answered on 21 Jul 2016, 04:26 PM
Thanks Tsonev, Petyo's answer did confirm what I said that these static attributes work, but failed to answer what I asked for, which is a link to the documentation.  Thanks for the link.  So, basically the doc page says that all "attributes" of a widget (like min max for the datapicker for example) can be specified in HTML using data-* attributes.  Thanks also for letting me know that this does work, but is different from MVVM bindings, which are much more limited.
0
Curt Rabon
Top achievements
Rank 1
Veteran
answered on 21 Jul 2016, 04:31 PM
So, I guess full support for data-attributes (full support meaning it now allows min/max for datepicker) was added sometime after Sept. 2014, because in Alexander Valchev's reply above, he states it's NOT possible.  When did it get added?  Thanks.
0
Petyo
Telerik team
answered on 26 Jul 2016, 12:39 PM
Hi,

if I understand you correctly, you are looking for the content of this help article.

Regards,
Petyo
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
Tags
MVVM
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Anil
Top achievements
Rank 1
Steven
Top achievements
Rank 1
Keith
Top achievements
Rank 2
Iron
Veteran
Petyo
Telerik team
Curt Rabon
Top achievements
Rank 1
Veteran
T. Tsonev
Telerik team
Share this question
or