title: Pikaday.js : Uncaught RangeError: Maximum call stack size exceeded
body: <p>I created a simple app which have table and chart with date filters. There's 4 choices. Today, Yesterday, This Month, and Last Month, and one Submit button. It's working perfectly when page load. The table show list all of model and the chart show data what I want expected, perfect.</p>
  
  <p>When I choosed a choice (for example : This Month) and click submit for first time, table and chart is refreshing, perfect.</p>
  
  <p>But when I choosed for second time, It's give me error, and page is freeze</p>
  
  <p>pikaday.js:70 Uncaught RangeError: Maximum call stack size exceeded.</p>
  
  <p><strong>Here's my part code</strong></p>
  
  <pre><code>            chartView.on("form:filter", function(data){
                  var criterion = data
                  filteredData.filter(criterion)
                  data1 = filteredData.filter(criterion)
                  chartView.trigger("view:render");
              })
  </code></pre>
  
  <p><strong>Here's full part code</strong></p>
  
  <pre><code>programming.module("Program.Chart",function(Chart, programming, Backbone, Marionette, $, _){
      Chart.Controller = {
          getData : function(){
  
              var data1 = programming.request("data:entities");
  
              if(data1 !== undefined){
                  var filteredData = programming.Program.FilteredCollection({
                      collection : data1,
                      filterFunction : function(criterion){
                          return function(data){
                              var dateModel = moment(data.get("tanggal"),'DD/MM/YYYY');
                              var startDate = moment(criterion.date1,'DD/MM/YYYY')
                              var endDate = moment(criterion.date2,'DD/MM/YYYY')
  
                              if(dateModel.isSameOrAfter(startDate)){
                                  if(dateModel.isSameOrBefore(endDate)){
                                      return data 
                                  }
                              }
                          }
                      }
                  })
  
                  chartView = new Chart.chartV({
                      collection: filteredData
                  })
  
                  chartView.on("form:filter", function(data){
                      var criterion = data
                      filteredData.filter(criterion)
                      data1 = filteredData.filter(criterion)
                      chartView.trigger("view:render");
                  })
  
                  chartView.on("view:render", function(){
                      //DatePicker
                      var format = "DD/MM/YYYY"
                      var date1 = new Pikaday({
                          field : $("#date1",this.el)[0],
                          format : format
                      })
                      $("#date1",this.el)[0].value = moment().add('days').format(format)
  
                      var date2 = new Pikaday({
                          field : $("#date2",this.el)[0],
                          format : format
                      })
                      $("#date2",this.el)[0].value = moment().add('days').format(format)
  
                      var selectdate = $('#publicdate',this.el)[0];
                      selectdate.addEventListener("change",function(){
                          var value = selectdate.value;
                          var date1 = $('#date1',this.el)[0];
                          var date2 = $('#date2',this.el)[0];
                          if(value==="today"){
                              date1.value = moment().add('days').format(format)
                              date2.value = moment().add('days').format(format)
                              $(date1).attr('disabled',true);
                              $(date2).attr('disabled',true);
                          } else if(value==="yesterday"){
                              date1.value = moment().add(-1,'days').format(format)
                              date2.value = moment().add(-1,'days').format(format)
                              $(date1).attr('disabled',true);
                              $(date2).attr('disabled',true);
                          } else if(value==="thismonth"){
                              date1.value = moment().add('month').startOf('month').format(format)
                              date2.value = moment().add('month').endOf('month').format(format)
  
                              $(date1).removeAttr('disabled',true);
                              $(date2).removeAttr('disabled',true);
                          } else if(value==="lastmonth"){
                              date1.value = moment().add(-1,'month').startOf('month').format('DD/MM/YYYY')
                              date2.value = moment().add(-1,'month').endOf('month').format('DD/MM/YYYY')
                              $(date1).attr('disabled',true);
                              $(date2).attr('disabled',true);
                          }
                      })
  
                      //Chartist JS                     
                      var labels = data1.models.map(function(model){
                          return model.get("tanggal");
                      })
                      var tshirtv = [];
                      var casev = [];    
                      var tanggal = [];
  
                      var series = data1.models.map(function(model,index){
                          tanggal[index] = model.get("tanggal");
                          if(model.get("produk")==="T-Shirt"){
                              tshirtv[index] = model.get("jumlah");
                              casev[index] ="0";
                          } else if(model.get("produk")==="Case"){
                              casev[index] = model.get("jumlah");
                              tshirtv[index] ="0";
                          }
                      })
  
                      tshirtv = tshirtv.filter(()=&gt;true)
                      casev = casev.filter(()=&gt;true)
                      var series = [
                          {
                              name : "T-shirt",
                              data : tshirtv
                          },
                          {
                              name : "Case",
                              data : casev
                          }
                      ]
  
                      //Line Chart
                      var data = {
                          labels : labels,
                          series : series
                      }
                      var option = {
                          showArea : true,
                          lineSmooth : false,
                          showPoint : true,
                          chartPadding : {
                              bottom:60,
                              top:60,
                          },
                          axisX : {
                              showGrid:false,
                          },
                          axisY : {  
                              onlyInteger : true,
                          },  
                          plugins : [
                              Chartist.plugins.ctAxisTitle({
                                  axisX: {
                                     axisClass: 'ct-axis-title',
                                     offset: {
                                        x: 0,
                                        y: 50
                                     },
                                     textAnchor: 'middle'
                                  },
                                  axisY: {
                                     axisTitle: 'Jumlah Penjualan',
                                     axisClass: 'ct-axis-title',
                                     offset: {
                                        x: 0,
                                        y: 0
                                     },
                                     textAnchor: 'middle',
                                     flipTitle: false
                                   }
                              }),
                              Chartist.plugins.ctPointLabels({
                                  textAnchor : "middle"
                              }),
                              Chartist.plugins.legend()
                          ]
                      }
  
                      //Donut Chart
                      var data2 = {
                          labels : ['T-Shirt', 'Case'],
                          series : [12,23]
                      }
                      var option2 = { 
                          chartPadding : {
                              top : 0,  
                          },
                          labelInterpolationFnc : function(value,series){
                              return value + ": " +data2.series[series].value
                          },
                          donut:true,
                          donutWidth : 60,
                          plugins : [
                              Chartist.plugins.legend()
                          ]
                      }
                      new Chartist.Line($('.statistic',this.el)[0],data,option)
                      //new Chartist.Pie($('.statistic2',this.el)[0],data2,option2)
                  })
  
  
                  programming.wrapper.show(chartView)
              } else {
                  chartView = new Chart.notfound()
  
                  programming.wrapper.show(chartView)
              }
  
  
          }
      }
  })
  </code></pre>