Uncaught TypeError: start.getDate is not a function

huangapple go评论89阅读模式
英文:

Uncaught TypeError: start.getDate is not a function

问题

我正在开发一个带有完整日历的预约系统。当选择一组日期时,我希望这些日期的值将被显示在一个div中,以便用户可以看到他选择的日期,并且还可以取消选择日期。

我一直在尝试使用console.log来记录选择的日期,但是我得到了上面的错误。对我来说已经很难继续前进了。

var calendar = new FullCalendar.Calendar(calendarEl, {
    headerToolbar: {
        start: 'title',
        center: '',
        end: ''
    },
    initialView: 'dayGridMonth',
    selectable: true,
    select: function(date, jsEvent, view) {
        date: date.getDate();
        backgroundColor: 'green';

        console.log('Selected: ' + date);
    },
});

我已经尝试添加date.toString(),但它不起作用。我还尝试使用日期的开始和结束,但仍然不按预期工作。

英文:

I am working on an appointment system with full calendar. I want when an array of dates are selected, the values of those dates will be echoed on a div for the user to see his selected dates and can also unselect the dates.

I have been trying to console.log selected dates but I get the above error. It is becoming impossible for me to move ahead.

<!-- language: lang-js -->

var calendar = new FullCalendar.Calendar(calendarEl, {
    headerToolbar: {
      start: &#39;title&#39;,
      center: &#39;&#39;,
      end: &#39;&#39;

    },
    initialView: &#39;dayGridMonth&#39;,
    selectable: true,
    select: function(date, jsEvent, view) {
      date: date.getDate();
      backgroundColor: &#39;green&#39;;

      console.log(&#39;Selected:  &#39; + date);
    },
  )
};

I have added date.toString() but it is not working. I have tried to use start and end of date but still not working as expect

答案1

得分: 1

根据文档,我看到 select 函数应该接受一个参数。例如:

select: function(selectionInfo){
    // 这里可以使用:selectionInfo.start
}
英文:

Reading the documentation I see that the select function should accept one parameter. For example:

select: function(selectionInfo){ 
... // then here you can have: selectionInfo.start 
 } 

huangapple
  • 本文由 发表于 2023年2月18日 16:43:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/75492167.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定