- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将 fullcalender 集成到 php mysql。我使用了以下代码。我想格式化日期,使其采用 yyyy/mm/dd 格式,但是当我使用格式语句时,代码无法正常工作。如果我删除格式日期,它似乎可以工作,但在数据库中插入 0000/0000/000 00:00 。
我的代码:
// Convert the allDay from string to boolean
eventRender: function(event, element, view) {
if (event.allDay === 'true') {
event.allDay = true;
}
else {
event.allDay = false;
}
},
selectable: true,
selectHelper: true,
select: function(start, end, allDay) {
var title = prompt('Sample Textbox:');
if (title) {
start = $.fullCalendar.formatDate(start, "yyyy-MM-dd HH:mm:ss");
end = $.fullCalendar.formatDate(end, "yyyy-MM-dd HH:mm:ss");
$.ajax({
url: 'http://localhost/fullcalendar/demos/add_events.php',
data: 'title='+ title+'&start='+ start +'&end='+ end ,
type: "POST",
success: function(json) {
alert('Added Successfully');
alert(json);
}
});
calendar.fullCalendar('renderEvent',
{
title: title,
start: start,
end: end,
allDay: allDay
},
true // make the event "stick"
);
}
calendar.fullCalendar('unselect');
},
谁能告诉我这是什么问题?如果我删除格式日期,它就可以工作,否则它就不起作用。但我必须格式化数据才能将其正确插入数据库中。我只想约会,不需要时间。
最佳答案
首先,如果您只查找日期而不是时间,您可能应该使用:
start = $.fullCalendar.formatDate(start, "yyyy/MM/dd");
end = $.fullCalendar.formatDate(end, "yyyy/MM/dd");
而不是这个:
start = $.fullCalendar.formatDate(start, "yyyy-MM-dd HH:mm:ss");
end = $.fullCalendar.formatDate(end, "yyyy-MM-dd HH:mm:ss");
如果您删除日期格式,它似乎可以工作,因为它像时间戳一样插入日期(它看起来像时间戳)。尝试将数据库结构类型更改为 VARCHAR,您将看到如下内容:
1405468800000
<小时/>
当您使用 dateFormat 函数时,您应该查看网络浏览器控制台日志。您可能会看到:
Uncaught TypeError: undefined is not a function
这是因为 fullCalendar V2 ( changeLog ) 上不再存在 $.fullCalendar.formatDate
方法。您可以将 Moment.js
与 .format()
方法 ( doc ) 结合使用。
不要忘记导入 moment.js
并将 start
和 end
变量编辑为:
start=moment(start).format('YYYY/MM/DD');
end=moment(end).format('YYYY/MM/DD');
它应该可以解决您的问题。
关于jquery - fullcalendar.formatdate 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24729721/
有没有办法在 FullCalendar 中动态更改事件模板? 更新。 我想要的是指定新的事件 html(例如在 eventRender 回调中)并使 FullCalendar 将其用于我的事件渲染。像
我正在使用 FullCalendar 组件,我需要为周末、周五和周六着色。 我已经按照这里的建议使用了以下内容: Can I set a different color for the weekend
我正在实现 fullcalendar 并在时区问题上苦苦挣扎。 这是代码: $('#calendar').fullCalendar({ //re-initialize the calendar
我希望 fullCalendar 在不重新加载页面的情况下重绘自身(所有结构和事件)。 场景: 我正在使用支持 Resource View 的 fullCalendar 补丁。 .对于一些用户操作,我
我想在同一页面上添加多个 FullCalendars(可选)以安排不同类型的事件并将信息保存在数据库中,但查看演示/示例代码,我似乎每页只能添加一个日历,因为它由 呈现。 .您能否让我知道是否有办法
我已将 FullCalendar 设置为接受 drop,确实如此。但是我用 revert:'invalid' 构造的可拖动对象似乎无法将 FullCalendar 上的日期识别为可放置的,并恢复回来。
我公司最近购买了 Full-Calendar Scheduler 插件。有没有正确的方法在代码中隐藏许可证 key ?对此有哪些好的做法? 最佳答案 你是对的,没有办法完全隐藏 schedulerLi
在 FullCalendar如何使资源可点击? 我已经检查了 API,但我看不到任何相关内容,我是否遗漏了什么? 我在找 resource-click -事件就像我们对事件一样? 最佳答案 在 res
我有额外的数据(在我的例子中是一个数字),它是通过一个 javascript 函数获得的——我想在每天的单元格中显示它。 例如 - 如果天数在右上角,我希望它显示在左上角 - 每天自动显示。 我看到有
我在单个页面上创建多个 fullcalendar,我想编写一个事件渲染回调,以便它可以从调用它的 fullcalendar 实例中读取选项,例如 minTime 和 maxTime,不知道如何做这个。
看起来默认值为 20 像素,但我希望将其提高,因此长度为 1 个时隙的事件将能够显示事件标题和正文。当前,当事件长度为 1 个时隙时,仅显示事件标题。 最佳答案 任何仍在寻找新版本答案的人。 在新版本
我正在尝试实现 this solution在 Fullcalendar 中“变灰”过去的事件,但我没有任何运气。不过,我不太精通 Javascript,所以我认为我犯了一些愚蠢的错误。 我已经将建议的
我使用 jQuery fullCalendar (http://arshaw.com/fullcalendar/docs/selection/unselectAuto/) 我使用这个日历的可选版本 (
这看起来非常简单,但我花了半天时间把头撞在墙上,试图弄清楚为什么我的全日历事件只显示在 77 像素,而单元格(月 View )的宽度似乎是 90 像素或更高。我曾尝试修改 fc-event css 规
我正在尝试在全日历中将时间格式更改为 24 小时制。 我试图找到它 here但我无法弄清楚。 这里的代码片段: jQuery('#calendar').fullCalendar({ heade
在月 View 中 fullcalendar 有一个很好的功能,可以在非全天事件的顶行显示开始时间。如果您不想在事件标题中提供更多详细信息,这可能很有用。 我想在月 View 中显示几个详细信息,例如
如何在 fullcalendar 中显示事件的描述? 我有具有标题和描述的事件。 那么如何显示描述呢? 最佳答案 当您添加标题和描述时,它将连接起来。 使用以下代码,您可以连接标题: eventRen
我正在尝试使用 FullCalendar 在网页上呈现 Google 日历中的事件。我想要开始日期/时间、描述和地点。 future 事件在一个 div 中,过去事件在另一个 div 中。 现在,我的
我正在尝试突出显示 FullCalender.io 中的选定日期(与当前日期类似)。 已关注 FullCalendar - Highlight a particular day in week vie
我是 FullCalendar 新手。在我的项目中,我需要显示带有时间范围的日历以及每天为每个培训中心分配的参与者。更准确地说,一天可以有很多个培训时段,由培训中心进行。因此,我想展示哪个培训中心分配
我是一名优秀的程序员,十分优秀!