Forums

Forums / Developing Portals / cannot set the maxDate

cannot set the maxDate

Thread is closed for posting
2 posts, 1 answered
  1. Missing user
    Missing user avatar
    25 Sep 2017
    Link to this post
    I have an issue when setting the maxDate of a dateTime picker from javascript.
    For minDate it works but when trying to set the maxDate it won't to note that no error is raising the scenario is when choosing issue date the valid date minDate will be = the chosen issue date and if user chooses the valid date before the issue date maxDate should be = the chosen valid date
    Here is the javascript code:
    --works for MinDate 
    tpc.forms[0].issuedate.add_valueChanged(function()
    {
    tpc.forms[0].validdate.get_model().MinDate = new Date(tpc.forms[0].issuedate.get_displayInput()[0].value);
    tpc.forms[0].validdate.set_model(tpc.forms[0].validdate.get_model());
    });
    --not working for MaxDate 
    tpc.forms[0].validdate.add_valueChanged(function()
    {
    tpc.forms[0].issuedate.get_model().MaxDate = new Date(tpc.forms[0].validdate.get_displayInput()[0].value);
    tpc.forms[0].issuedate.set_model(tpc.forms[0].issuedate.get_model());
    });

  2. Missing user
    Missing user avatar
    Answered
    24 Oct 2017 in reply to Missing user
    Link to this post
    For this issue we would recommend to use Kendo function as shown below for example on birthdate field:

    Max Date:
    tpc.forms[0].birthdate.get_kendoInput().max(new Date())

    Min Date:
    tpc.forms[0].birthdate.get_kendoInput().min(new Date("2017/09/01"))

    You may also refer to the following documentation for more information:
    http://docs.telerik.com/kendo-ui/api/javascript/ui/datetimepicker

    Thanks,

    Sonam Joshi
2 posts, 1 answered