Why Kendo DateRangePicker change event fire multiple times?

464 views Asked by At

I´m using KendoDateRangePicker for the first time and I notice that the change event fires multiple times (3). Why? Is this a kendo bug?

here is my sample

 $("#daterangepicker").kendoDateRangePicker({
                format: "dd/MM/yyyy",
                change: function () {
                    var range = this.range();                    
                    var rangeStart = convertDate(range.start, "-");
                    if (range.end) {
                        var rangeEnd = convertDate(range.end, "-");
                    } else {
                        rangeEnd = "";
                    }
                    
                    console.log(rangeStart, rangeEnd);

                    function convertDate(d, separator) {
                        var dd = d.getDate();
                        var mm = d.getMonth();
                        var yyyy = d.getFullYear();
                        return dd + separator + mm + separator + yyyy;
                    }                   
                    
                }

            });
<div id="daterangepicker" title="daterangepicker"></div>

2

There are 2 answers

0
GaloisGirl On BEST ANSWER

I believe it's a bug: it goes against the description in the documentation at https://docs.telerik.com/kendo-ui/api/javascript/ui/daterangepicker/events/change :

Fires when the selected date is changed

Ideally, file it at https://github.com/telerik/kendo-ui-core/issues .

0
Miika L. On