使用Fullcalendar和Google Calendar将类添加到过去的事件

使用Fullcalendar和Google Calendar将类添加到过去的事件,fullcalendar,Fullcalendar,我想更改过去事件的颜色,我想我需要为它们添加一个类,但这就是问题所在,我是如何做到的?我做到了(硬编码): 渲染前: var hoy = new Date;// get today's date hoy = parseInt((hoy.getTime()) / 1000); //get today date in unix 创建html时,在“for”内: unixevent=parseInt((event.end.getTime())/1000)//Unix中的事件日期 if(unixev

我想更改过去事件的颜色,我想我需要为它们添加一个类,但这就是问题所在,我是如何做到的?

我做到了(硬编码):

  • 渲染前:

    var hoy = new Date;// get today's date
    hoy = parseInt((hoy.getTime()) / 1000); //get today date in unix
    
  • 创建html时,在“for”内:

    unixevent=parseInt((event.end.getTime())/1000)//Unix中的事件日期
    if(unixevent
  • 在css文件中添加一个新的“fc passed”类


  • 最好将该类添加到事件对象的“className”属性中

    根据FullCalendar v1.6.4

    在css中设置过去事件的样式:

    .fc-past{background-color:red;}
    
    .fc-future{background-color:red;}
    
    在css中设置未来事件的样式:

    .fc-past{background-color:red;}
    
    .fc-future{background-color:red;}