N
N
Nikolay Baranenko2017-08-21 14:44:02
JavaScript
Nikolay Baranenko, 2017-08-21 14:44:02

How to dynamically change minDate and maxDate bounds in datetimepicker?

Hello.
i have 2 datetimepicker on form with and by
define them in document.create like this

$(document).ready(function()
    {
        $('#datetime_from').datetimepicker(
            {
                maxDate: tdatetime,
                onSelect: function(selected,evnt) {
                    updateDateTime_from(selected);
                }
            }
        ).datetimepicker("setDate", fdatetime);

        $('#datetime_to').datetimepicker(
            {
                minDate: fdatetime,
                onSelect: function(selected,evnt) {
                    updateDateTime_to(selected);
                }
            }
        ).datetimepicker("setDate", tdatetime);
});

outside I define updateDateTime_from, updateDateTime_to
in order to process the change of date and time selection in them I try to adjust the minDate and maxDate options
function updateDateTime_from(value){
$("#datetime_to").datetimepicker("option", "minDate", value);
};
function updateDateTime_to(value){
$("#datetime_from").datetimepicker("option", "maxDate", value);
};

in fact, dynamically transferring to value passes correctly, BUT the change of minDate and maxDate does not occur ....
What is the error and how to solve it?
made a mockup https://jsfiddle.net/drno/ahvLcexq/
change the date With
001d9d85466c4ad9ac642a831ecbb38c.jpg
it changes
0f753f124a9d429bb1a81d33c26cc90a.jpg
, the min date in the software should move, but it does not move
451f639a807740349c3fe846ad231a01.jpg

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question