fullcalendar自定义结束日期

时间:2016-01-12 12:05:03

标签: javascript jquery fullcalendar

是否可以根据选择框中的选项创建自定义结束日期? 假设我有这个HTML - 它有一个标题和一个事件的持续时间:

<select name="event-title" id="event-title">
  <option value="Træning" data-duration="01:00">Træning</option>
  <option value="Træning + Måling" data-duration="01:15">Træning og måling</option>
  <option value="Billeder" data-duration="00:20">Foto Session</option>
</select>

点击添加活动时,结束日期/时间应该是点击的日期和开始时间+持续时间:

请在此处查看评论代码:

select: function (start, end, allDay) {
  $('#fc_create').click(); //trigger modal
  var startHours = moment(start).format('hh:mm'),
      started = start,
      ended = end;

  //started variable could return: Mon Jan 11 2016 09:10:00 GMT+0000

  //Set value to selected time
  $("#event-start").val(startHours);

  $(".antosubmit").on("click", function () {
    var title = $("#event-title").val(),
        duration = $("#event-title").find("option:selected").data('duration');

    if (end) {
      //Returns ex: Mon Jan 11 2016 09:35:00 GMT+0000
      // However, the end time here should be the starttime + the duration - So in this it should be: 10.10
      // as the start time was 09:10 + a duration on 1 hour (from the selectbox)
      ended = end 
    }

    if (title) {
      calendar.fullCalendar('renderEvent', {
        title: title,
        start: started,
        end: end,
        allDay: false
      },
      true); // make the event "stick"
    }
    $('#title').val('');
    calendar.fullCalendar('unselect');

    $('.antoclose').click();

    return false;
  });
}

1 个答案:

答案 0 :(得分:1)

试试这个!

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".get_bloginfo('url'));
exit();
?>